discourse/config/initializers/100-sprockets.rb

22 lines
681 B
Ruby
Raw Normal View History

require_dependency 'sass/discourse_stylesheets'
require_dependency 'sass/discourse_sass_importer'
require_dependency 'sass/discourse_safe_sass_importer'
2014-11-11 09:58:56 +08:00
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