2014-05-02 17:46:03 -04:00
|
|
|
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
|
2016-04-17 22:47:52 -04:00
|
|
|
::Sass::Engine.new(contents, options.merge(
|
2014-05-02 17:46:03 -04:00
|
|
|
filename: "#{name}.scss",
|
|
|
|
importer: self,
|
|
|
|
syntax: :scss
|
|
|
|
))
|
|
|
|
else
|
|
|
|
super(name, options)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|