diff --git a/Gemfile_master.lock b/Gemfile_master.lock index 83b77863c4c..750460d15b7 100644 --- a/Gemfile_master.lock +++ b/Gemfile_master.lock @@ -64,11 +64,11 @@ GIT GIT remote: https://github.com/rails/sass-rails.git - revision: 423178729e7b84addcee78b33891644b1fc1705b + revision: b4b5f32a2928ef203f4b442bc538a572645de8e3 specs: sass-rails (5.0.0.beta1) railties (>= 4.0.0, < 5.0) - sass (~> 3.2) + sass (~> 3.2, >= 3.2.2) sprockets (~> 2.12) sprockets-rails (>= 2.0, < 4.0) diff --git a/config/initializers/sprockets.rb b/config/initializers/sprockets.rb index 89ab0998692..1159f514c7d 100644 --- a/config/initializers/sprockets.rb +++ b/config/initializers/sprockets.rb @@ -2,5 +2,20 @@ require_dependency 'sass/discourse_stylesheets' require_dependency 'sass/discourse_sass_importer' require_dependency 'sass/discourse_safe_sass_importer' -Sprockets.send(:remove_const, :SassImporter) -Sprockets::SassImporter = DiscourseSassImporter +if defined?(Sass::Rails::SassTemplate) + DiscourseSassTemplate = Class.new(Sass::Rails::SassTemplate) do + def importer_class + DiscourseSassImporter + end + end + DiscourseScssTemplate = Class.new(DiscourseSassTemplate) do + def syntax + :scss + end + end + Rails.application.assets.register_engine '.sass', DiscourseSassTemplate + Rails.application.assets.register_engine '.scss', DiscourseScssTemplate +else + Sprockets.send(:remove_const, :SassImporter) + Sprockets::SassImporter = DiscourseSassImporter +end