mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
FEATURE: support user local switching to RTL correctly
FEATURE: support RTL in multisite
This commit is contained in:
@@ -63,10 +63,8 @@ class DiscourseSassCompiler
|
||||
}
|
||||
}.merge(debug_opts)).render
|
||||
|
||||
# Check if CSS needs to be RTLed after compilation
|
||||
# and run R2 gem on compiled CSS if true and R2 gem is available
|
||||
css_output = css
|
||||
if !SiteSetting.allow_user_locale && SiteSetting.default_locale.in?(%w(he ar fa_IR))
|
||||
if opts[:rtl]
|
||||
begin
|
||||
require 'r2'
|
||||
css_output = R2.r2(css) if defined?(R2)
|
||||
|
||||
@@ -91,8 +91,9 @@ class DiscourseStylesheets
|
||||
end
|
||||
|
||||
scss = File.read("#{Rails.root}/app/assets/stylesheets/#{@target}.scss")
|
||||
rtl = @target.to_s =~ /_rtl$/
|
||||
css = begin
|
||||
DiscourseSassCompiler.compile(scss, @target)
|
||||
DiscourseSassCompiler.compile(scss, @target, rtl: rtl)
|
||||
rescue Sass::SyntaxError => e
|
||||
Rails.logger.error "Stylesheet failed to compile for '#{@target}'! Recompiling without plugins and theming."
|
||||
Rails.logger.error e.sass_backtrace_str("#{@target} stylesheet")
|
||||
|
||||
@@ -78,7 +78,7 @@ task 'assets:precompile:css' => 'environment' do
|
||||
# css will get precompiled during first request instead in that case.
|
||||
if ActiveRecord::Base.connection.table_exists?(ColorScheme.table_name)
|
||||
puts "Compiling css for #{db}"
|
||||
[:desktop, :mobile].each do |target|
|
||||
[:desktop, :mobile, :desktop_rtl, :mobile_rtl].each do |target|
|
||||
puts DiscourseStylesheets.compile(target)
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user