mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
FEATURE: Multiple SCSS file support for themes (#7351)
Theme developers can include any number of scss files within the /scss/ directory of a theme. These can then be imported from the main common/desktop/mobile scss.
This commit is contained in:
@@ -59,4 +59,52 @@ describe Stylesheet::Importer do
|
||||
|
||||
end
|
||||
|
||||
context "extra_scss" do
|
||||
let(:scss) { "body { background: red}" }
|
||||
let(:theme) { Fabricate(:theme).tap { |t|
|
||||
t.set_field(target: :extra_scss, name: "my_files/magic", value: scss)
|
||||
t.save!
|
||||
}}
|
||||
|
||||
let(:importer) { described_class.new(theme: theme) }
|
||||
|
||||
it "should be able to import correctly" do
|
||||
# Import from regular theme file
|
||||
expect(
|
||||
importer.imports(
|
||||
"my_files/magic",
|
||||
"theme_#{theme.id}/desktop-scss-mytheme.scss"
|
||||
).source).to eq(scss)
|
||||
|
||||
# Import from some deep file
|
||||
expect(
|
||||
importer.imports(
|
||||
"my_files/magic",
|
||||
"theme_#{theme.id}/some/deep/folder/structure/myfile.scss"
|
||||
).source).to eq(scss)
|
||||
|
||||
# Import from parent dir
|
||||
expect(
|
||||
importer.imports(
|
||||
"../../my_files/magic",
|
||||
"theme_#{theme.id}/my_files/folder1/myfile.scss"
|
||||
).source).to eq(scss)
|
||||
|
||||
# Import from same dir without ./
|
||||
expect(
|
||||
importer.imports(
|
||||
"magic",
|
||||
"theme_#{theme.id}/my_files/myfile.scss"
|
||||
).source).to eq(scss)
|
||||
|
||||
# Import from same dir with ./
|
||||
expect(
|
||||
importer.imports(
|
||||
"./magic",
|
||||
"theme_#{theme.id}/my_files/myfile.scss"
|
||||
).source).to eq(scss)
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user