JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 313
  • Score
    100M100P100Q85364F
  • License MIT

Preset for scss webpack configuration

Package Exports

  • scss-config-webpack-plugin
  • scss-config-webpack-plugin/src/index.js

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (scss-config-webpack-plugin) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

scss-config-webpack-plugin

NPM version Build Status lerna License Commitizen friendly Prettier

Creating a webpack loader configurations can be quite time consuming.
The scss-config-webpack-plugin is part of the common-config-webpack-plugin suite which tries to provide best practices for the most common loader requirements.

If no mode is explicitly set for the plugin the configuration will adjust depending on your webpack mode setting. The injected configurations are based on create-react-app css part
⚙️development mode webpack.config.js ⚙️production mode webpack.config.js

Installation

npm i --save-dev scss-config-webpack-plugin

Webpack Config

In most projects you will need to set up project specific options but you can still use all or some common-config-webpack-plugin parts.

const ScssConfigWebpackPlugin = require('scss-config-webpack-plugin');
module.exports = {
  plugins: [new ScssConfigWebpackPlugin()],
};

Output filename

Webpack allows to configure the output file name for javascript files with output.filename. By default the ScssConfigWebpackPlugin will reuse this option but will replace .js to .css and /js/ to /css/.

const ScssConfigWebpackPlugin = require('scss-config-webpack-plugin');
module.exports = {
  output: {
    filename: 'js/app.js',
  },
  plugins: [
    new ScssConfigWebpackPlugin(), // Generates a new file called css/app.css
  ],
};

If this behaviour doesn't fit your needs you can set a different name using the filename option:

const ScssConfigWebpackPlugin = require('scss-config-webpack-plugin');
module.exports = {
  plugins: [
    new ScssConfigWebpackPlugin({
      filename: 'css/main.min.css',
    }),
  ],
};

css modules

Just as create-react-app the scss-config-webpack-plugin supports CSS Modules with the extension .module.css or .module.scss.