-
Notifications
You must be signed in to change notification settings - Fork 365
Promote .scss.liquid only for theme editor style overrides #259
Comments
I feel like there might be a creative solution to use webpack to bring in a theme's live Currently I'm hitting a road block transitioning to Slate 1.0 due to the challenges and limitations of chaining variables from liquid to CSS to SCSS (issues below). At this point I have to give up local SCSS compiling for blazing fast previews, and switch back to the slow, old-school way of using Slate to upload the asset every time the file is changed.
JSON to SCSSResearching webpack, JSON and Sass I came across sass-vars-loader and node-sass-json-importer which could be potential solutions. This webpack loader can import a JSON file to so that the values could be used directly in SCSS. // settings_data.live.json
{
"color_accent": "#d93f0f",
"typography_base_size": "16px"
} // theme.scss
body {
font-size: $typography_base_size;
}
h1 {
font-size: $typography_base_size * 1.75;
}
a {
color: $color_accent;
} Then during build the live settings json data could generate SCSS vars with liquid values. // theme.scss.liquid
// Generated during webpack production build
$color_accent: {{ settings.color_accent }};
$typography_base_size: {{ settings.typography_base_size }};
body {
font-size: $typography_base_size;
}
h1 {
font-size: $typography_base_size * 1.75;
}
a {
color: $color_accent;
} Advantages
Challenges
|
I think we have the basics of this covered in https://github.com/Shopify/slate/wiki/Styles-with-Liquid. We're working through the kinks, like those mentioned by @jonathanmoore, one at a time. In general I think we have a decent direction for Liquid styles! |
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
Liquid was not designed to be used in SCSS. However, we need it to allow theme styles to be customized by the Theme Editor. As noted in #258,
.scss.liquid
is hard to work with and can ultimately only be built on our servers. I believe for these reasons we should use it as little as possible.Traditionally, we have defaulted to using
.scss.liquid
everywhere. I propose that we start usingscss.liquid
only for styles that are changed by the Theme Editor, and that these styles override default styles specified in.scss
. For example:theme.scss
theme.scss.liquid
How we actually accomplish this with a easy workflow is still a mystery to me... More experimentation to come.
The text was updated successfully, but these errors were encountered: