FIX: Include extra SCSS in child theme (#11952)
This commit is contained in:
parent
db7b7eed9d
commit
2309032e68
|
@ -193,10 +193,21 @@ module Stylesheet
|
|||
// Theme: #{field.theme.name}
|
||||
// Target: #{field.target_name} #{field.name}
|
||||
// Last Edited: #{field.updated_at}
|
||||
|
||||
#{value}
|
||||
COMMENT
|
||||
|
||||
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
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
contents
|
||||
end
|
||||
|
|
|
@ -795,13 +795,16 @@ HTML
|
|||
expect(css).to include("p{color:blue}")
|
||||
end
|
||||
|
||||
it "works for child themes" do
|
||||
it "works for child themes and includes child theme SCSS in parent theme" do
|
||||
child_theme.set_field(target: :common, name: :scss, value: '@import "my_files/moremagic"')
|
||||
child_theme.save!
|
||||
|
||||
manager = Stylesheet::Manager.new(:desktop_theme, child_theme.id)
|
||||
css, _map = manager.compile(force: true)
|
||||
expect(css).to include("body{background:green}")
|
||||
|
||||
parent_css, _parent_map = compiler
|
||||
expect(parent_css).to include("body{background:green}")
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
@ -38,7 +38,7 @@ describe ThemesInstallTask do
|
|||
end
|
||||
|
||||
let :scss_data do
|
||||
"@font-face { font-family: magic; src: url($font)}; body {color: $color; content: $name;}"
|
||||
"@font-face { font-family: magic; src: url($font)}; body {color: fuchsia;}"
|
||||
end
|
||||
|
||||
let :theme_repo do
|
||||
|
|
Loading…
Reference in New Issue