Slate CSSVar Loader
Finds CSS custom properties (variables) in your stylesheets and replaces them with their corresponding Liquid variable found in the provided cssVariablesPath
option.
Install
npm install --save-dev @shopify/slate-cssvar-loader
Usage
webpack.config.js example
module.exports = {
module: {
rules: [
{
test: /\.s[ac]ss$/,
use: [
{
loader: '@shopify/slate-cssvar-loader'
},
{ loader: 'css-loader' },
{ loader: 'sass-loader' }
]
}
]
}
};
Configuration
The slate-cssvar-loader
can be configured via the theme's slate.config.js
file:
{
"cssVarLoaderEnable": true,
"cssVarLoaderLiquidPath": ["src/snippets/css-variables.liquid"]
}
cssVarLoaderEnable
: Enable/disable CSS Variable loader plugincssVarLoaderLiquidPath
: An array of string paths to Liquid files that associate css variables to Liquid variables