1.0.4 • Published 6 years ago

style-webpack-plugin v1.0.4

Weekly downloads
4
License
MIT
Repository
github
Last release
6 years ago

style-webpack-plugin

Install

npm install style-webpack-plugin --save-dev

Usage

// webpack.config.js
import { join } from psth;

module.exports = {
    entry: './src/js/index.js',
    plugins: [
        new StylePlugin({
            './src/styles/index.scss': 'styles/index.css'
        }),
    ],
    module: {
      // babel, linter, etc
    },
    output: {
      path: path.join(__dirname, 'dist');,
      filename: 'index.js'
    }
  };

Other Example

// basic
new StylePlugin('./src/styles/index.scss');

// production ready
new StylePlugin('./src/styles/index.scss', process.env.NODE_ENV);

// multi files
new StylePlugin(['./src/styles/one.scss', './src/styles/two.sass'], process.env.NODE_ENV);

// a different output filename
new StylePlugin({ './src/styles/index.scss': 'bundle.css' }, process.env.NODE_ENV);

// with sass tuning
new StylePlugin('./src/styles/index.scss', process.env.NODE_ENV, {
    sass: {
        includePaths: [path.join(__dirname, 'node_modules/bootstrap-sass/assets/stylesheets')]
    }
});

// with source maps + compressing - autoprefixing
new StylePlugin('./src/styles/index.scss', {
    sourceMap: true,
    sass: { outputStyle: 'compressed' },
    autoprefixer: false
});

Reference

base on sass-webpack-plugin

1.0.4

6 years ago

1.0.3

6 years ago

1.0.2

6 years ago

1.0.1

6 years ago

1.0.0

6 years ago