Add RTL support to Discourse CSS pre-processing using the RTLit gem and configurable via discourse.conf
This commit is contained in:
parent
c1cbf1b269
commit
557af8b8bd
1
Gemfile
1
Gemfile
|
@ -154,6 +154,7 @@ gem 'rack-protection' # security
|
|||
group :assets do
|
||||
gem 'sass-rails', '~> 4.0.2'
|
||||
gem 'uglifier'
|
||||
gem 'rtlit' # for css rtling
|
||||
end
|
||||
|
||||
group :test do
|
||||
|
|
|
@ -308,6 +308,7 @@ GEM
|
|||
rspec-core (~> 2.14.0)
|
||||
rspec-expectations (~> 2.14.0)
|
||||
rspec-mocks (~> 2.14.0)
|
||||
rtlit (0.0.5)
|
||||
ruby-openid (2.5.0)
|
||||
ruby-readability (0.6.1)
|
||||
guess_html_encoding (>= 0.0.4)
|
||||
|
@ -464,6 +465,7 @@ DEPENDENCIES
|
|||
rmmseg-cpp
|
||||
rspec-given
|
||||
rspec-rails
|
||||
rtlit
|
||||
ruby-readability
|
||||
sanitize
|
||||
sass
|
||||
|
|
|
@ -97,3 +97,6 @@ serve_static_assets = false
|
|||
|
||||
# number of sidekiq workers (launched via unicorn master)
|
||||
sidekiq_workers = 5
|
||||
|
||||
# adjust stylesheets to rtl (requires "rtlit" gem)
|
||||
rtl_css = false
|
|
@ -49,7 +49,7 @@ class DiscourseSassCompiler
|
|||
style: :expanded
|
||||
}
|
||||
|
||||
::Sass::Engine.new(@scss, {
|
||||
css = ::Sass::Engine.new(@scss, {
|
||||
syntax: :scss,
|
||||
cache: false,
|
||||
read_cache: false,
|
||||
|
@ -60,6 +60,14 @@ class DiscourseSassCompiler
|
|||
environment: context.environment
|
||||
}
|
||||
}.merge(debug_opts)).render
|
||||
|
||||
# Check if CSS needs to be RTLed after compilation
|
||||
# and run RTLit gem on compiled CSS if true and RTLit gem is available
|
||||
if GlobalSetting.rtl_css && defined?(RTLit)
|
||||
RTLit::Converter.to_rtl(css)
|
||||
else
|
||||
css
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue