mirror of
https://github.com/discourse/discourse.git
synced 2025-05-22 07:53:49 +08:00
Merge pull request #2244 from vikhyat/css-import
Site Customization @import fixes
This commit is contained in:
@ -14,12 +14,26 @@ class SiteCustomization < ActiveRecord::Base
|
||||
end
|
||||
|
||||
def compile_stylesheet(scss)
|
||||
# Get the sprockets environment. In production Rails.application.assets is a
|
||||
# Sprockets::Index instead of Sprockets::Environment, there is no cleaner way
|
||||
# to get the environment from the index.
|
||||
env = Rails.application.assets
|
||||
if env.is_a?(Sprockets::Index)
|
||||
env = env.instance_variable_get('@environment')
|
||||
end
|
||||
|
||||
context = env.context_class.new(env, "custom.scss", "app/assets/stylesheets/custom.scss")
|
||||
|
||||
::Sass::Engine.new(scss, {
|
||||
syntax: :scss,
|
||||
cache: false,
|
||||
read_cache: false,
|
||||
style: :compressed,
|
||||
filesystem_importer: DiscourseSassImporter
|
||||
filesystem_importer: DiscourseSassImporter,
|
||||
sprockets: {
|
||||
context: context,
|
||||
environment: context.environment
|
||||
}
|
||||
}).render
|
||||
|
||||
rescue => e
|
||||
|
Reference in New Issue
Block a user