DEV: Refactor theme SCSS compilation (#11919)

This commit is contained in:
Penar Musaraj
2021-02-02 13:09:41 -05:00
committed by GitHub
parent f88def5f5b
commit e8b82724fd
12 changed files with 173 additions and 209 deletions

View File

@ -343,10 +343,14 @@ class ThemeField < ActiveRecord::Base
end
def compile_scss
Stylesheet::Compiler.compile("@import \"common/foundation/variables\"; @import \"common/foundation/mixins\"; @import \"theme_variables\"; @import \"theme_field\";",
"theme.scss",
theme_field: self.value.dup,
theme: self.theme
scss = <<~SCSS
@import "common/foundation/variables"; @import "common/foundation/mixins"; #{self.theme.scss_variables.to_s} #{self.value}
SCSS
Stylesheet::Compiler.compile(scss,
"#{Theme.targets[self.target_id]}.scss",
theme: self.theme,
load_paths: self.theme.scss_load_paths
)
end