Skip to content
This repository has been archived by the owner on Jul 19, 2021. It is now read-only.

Slate CSSVar Loader

Chris Berthe edited this page May 3, 2018 · 1 revision

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 plugin
  • cssVarLoaderLiquidPath: An array of string paths to Liquid files that associate css variables to Liquid variables