@ptb/gatsby-1-config-css-modules
CSS Modules configuration for Gatsby v1 plugins
Last updated 3 years ago by ptb .
MIT · Original npm · Tarball · package.json
$ cnpm install @ptb/gatsby-1-config-css-modules 
SYNC missed versions from official npm registry.

gatsby-1-config-css-modules

CSS Modules configuration for Gatsby v1 plugins

Install

yarn add --dev gatsby-plugin-sass

How to use

Example from gatsby-plugin-sass:

// in gatsby-node.js
const { cssModulesConfig } = require("gatsby-1-config-css-modules");

exports.modifyWebpackConfig = ({ config, stage }, { precision }) => {
  const sassFiles = /\.s[ac]ss$/;
  const sassModulesFiles = /\.module\.s[ac]ss$/;
  const sassLoader = precision ? `sass?precision=${precision}` : `sass`;

  switch (stage) {
    case `develop`: {
      config.loader(`sass`, {
        test: sassFiles,
        exclude: sassModulesFiles,
        loaders: [`style`, `css`, sassLoader],
      });

      config.loader(`sassModules`, {
        test: sassModulesFiles,
        loaders: [`style`, cssModulesConfig(stage), sassLoader],
      });
      return config;
    }

    // etc.
  }
};

Current Tags

  • 1.0.8                                ...           latest (3 years ago)

1 Versions

  • 1.0.8                                ...           3 years ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 0
Dependencies (1)
Dev Dependencies (2)
Dependents (1)

Copyright 2014 - 2016 © taobao.org |