discourse/lib/sass/discourse_safe_sass_importer.rb
Guo Xiang Tan 256d7a00e9 Update sprockets. (#4167)
* Update sass-rails.

* FIX: Tilt dependency has been removed from Ember::Handlebars::Template.

* Update `DiscourseIIFE` to new Sprockets API.

* `Rails.application.assets` returns `nil` in production.

* Move sprockets-rails out of the assets group.

* Pin ember-rails to 0.18.5 which works with Sprockets 3.x.

* Update sprockets to 3.6.0.

* Make `DiscourseSassCompiler` work with Sprockets 3.

* Use `Sass::Rails::SassImporterGlobbing` instead of haxxing our own.

* Moneky patch so that we don't add dependencies for our custom css.

* FIX: Missing class.

* Upgrade ember-handlebars-template.

* FIX: require path needs to share the same root as the folder's path.

* Bump discourse-qunit-rails.

* Update ember-template-compiler.js to 1.12.2.

* `prepend` is private in Ruby 2.0.0.
2016-04-18 10:47:52 +08:00

33 lines
834 B
Ruby

require_dependency 'sass/discourse_sass_importer'
# This custom importer is used to import stylesheets but excludes plugins and theming.
# It's used as a fallback when compilation of stylesheets fails.
class DiscourseSafeSassImporter < DiscourseSassImporter
def special_imports
super.merge({
"plugins" => [],
"plugins_mobile" => [],
"plugins_desktop" => [],
"plugins_variables" => []
})
end
def find(name, options)
if name == "theme_variables"
# Load the default variables
contents = ""
special_imports[name].each do |css_file|
contents << File.read(css_file)
end
::Sass::Engine.new(contents, options.merge(
filename: "#{name}.scss",
importer: self,
syntax: :scss
))
else
super(name, options)
end
end
end