mirror of
https://github.com/discourse/discourse.git
synced 2025-06-06 03:06:53 +08:00
FIX: Improve SCSS handling in components (#11963)
- ignores errors when including component SCSS in parent theme - adds support for SCSS `@import`s in components' `color_definitions.scss` files
This commit is contained in:
@ -141,9 +141,15 @@ module Stylesheet
|
||||
if resolved_ids
|
||||
theme = Theme.find_by_id(theme_id)
|
||||
contents << theme&.scss_variables.to_s
|
||||
Theme.list_baked_fields(resolved_ids, :common, :color_definitions).each do |row|
|
||||
contents << "// Color definitions from #{theme.name}\n\n"
|
||||
contents << row.value
|
||||
Theme.list_baked_fields(resolved_ids, :common, :color_definitions).each do |field|
|
||||
contents << "// Color definitions from #{field.theme.name}\n\n"
|
||||
|
||||
if field.theme_id == theme.id
|
||||
contents << field.value
|
||||
else
|
||||
contents << field.compiled_css
|
||||
end
|
||||
contents << "\n\n"
|
||||
end
|
||||
end
|
||||
contents
|
||||
@ -198,13 +204,7 @@ module Stylesheet
|
||||
if field.theme_id == theme.id
|
||||
contents << value
|
||||
else
|
||||
css, source_map = begin
|
||||
field.compile_scss
|
||||
rescue SassC::SyntaxError => e
|
||||
raise Discourse::ScssError, e.message
|
||||
end
|
||||
|
||||
contents << css
|
||||
contents << field.compiled_css
|
||||
end
|
||||
end
|
||||
|
||||
|
Reference in New Issue
Block a user