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
|
group :assets do
|
||||||
gem 'sass-rails', '~> 4.0.2'
|
gem 'sass-rails', '~> 4.0.2'
|
||||||
gem 'uglifier'
|
gem 'uglifier'
|
||||||
|
gem 'rtlit' # for css rtling
|
||||||
end
|
end
|
||||||
|
|
||||||
group :test do
|
group :test do
|
||||||
|
|
|
@ -308,6 +308,7 @@ GEM
|
||||||
rspec-core (~> 2.14.0)
|
rspec-core (~> 2.14.0)
|
||||||
rspec-expectations (~> 2.14.0)
|
rspec-expectations (~> 2.14.0)
|
||||||
rspec-mocks (~> 2.14.0)
|
rspec-mocks (~> 2.14.0)
|
||||||
|
rtlit (0.0.5)
|
||||||
ruby-openid (2.5.0)
|
ruby-openid (2.5.0)
|
||||||
ruby-readability (0.6.1)
|
ruby-readability (0.6.1)
|
||||||
guess_html_encoding (>= 0.0.4)
|
guess_html_encoding (>= 0.0.4)
|
||||||
|
@ -464,6 +465,7 @@ DEPENDENCIES
|
||||||
rmmseg-cpp
|
rmmseg-cpp
|
||||||
rspec-given
|
rspec-given
|
||||||
rspec-rails
|
rspec-rails
|
||||||
|
rtlit
|
||||||
ruby-readability
|
ruby-readability
|
||||||
sanitize
|
sanitize
|
||||||
sass
|
sass
|
||||||
|
|
|
@ -97,3 +97,6 @@ serve_static_assets = false
|
||||||
|
|
||||||
# number of sidekiq workers (launched via unicorn master)
|
# number of sidekiq workers (launched via unicorn master)
|
||||||
sidekiq_workers = 5
|
sidekiq_workers = 5
|
||||||
|
|
||||||
|
# adjust stylesheets to rtl (requires "rtlit" gem)
|
||||||
|
rtl_css = false
|
|
@ -49,7 +49,7 @@ class DiscourseSassCompiler
|
||||||
style: :expanded
|
style: :expanded
|
||||||
}
|
}
|
||||||
|
|
||||||
::Sass::Engine.new(@scss, {
|
css = ::Sass::Engine.new(@scss, {
|
||||||
syntax: :scss,
|
syntax: :scss,
|
||||||
cache: false,
|
cache: false,
|
||||||
read_cache: false,
|
read_cache: false,
|
||||||
|
@ -60,6 +60,14 @@ class DiscourseSassCompiler
|
||||||
environment: context.environment
|
environment: context.environment
|
||||||
}
|
}
|
||||||
}.merge(debug_opts)).render
|
}.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
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue