パッケージの詳細

csso-webpack-plugin

zoobestik341.1k2.0.0-beta.3

CSSO minification files to serve your webpack bundles

css, minify, csso, webpack

readme

CSSO Webpack Plugin

npm node dependencies status downloads

Logo

Why is not csso-loader or postcss-csso?

  • Full restructuring in bundles: better

  • No problems with custom syntax like css-modules:global(.c .d) .a { color: #fff; } syntax

  • Possible to generate both pure and minimized versions at the same time.

Install

npm i -D csso-webpack-plugin

For node < 8.0.0 use 1.x version with csso@^3:

npm i -D csso-webpack-plugin@1

Usage

Plugin good to use in pair with ExtractTextPlugin or MiniCssExtractPlugin.

const CssoWebpackPlugin = require('csso-webpack-plugin').default;

module.exports = {
  module: { /* ... */ },
  plugins: [
    new MiniCssExtractPlugin({
      filename: "[name].css",
      chunkFilename: "[id].css"
    }),
    new CssoWebpackPlugin(),
  ]
}

Options

new CssoWebpackPlugin([options: CssoOptions], [filter: function | RegExp])

Arguments:

  • optionscsso options.
  • options.pluginOutputPostfixfunction(file) or string postfix, if passed, plugin will create two assets vanilla and compressed. Example:
     {
         plugins: [
             new ExtractTextPlugin('test.css'),
             new CssoWebpackPlugin({ pluginOutputPostfix: 'min' })
             /* Generated:
                 test.css — uncompressed file
                 test.min.css — minimized with csso file
             */
         ]
     }
  • filter — Detect should be file processed. Defaults: to ends with .css.

Flow support

I don't now why, but plugin ships with flow typings (typedef too). To use them in your project, add this to the [libs] section of your .flowconfig:

[libs]
node_modules/csso-webpack-plugin/lib/index.js.flow

Acknowledgements

Develop By Logo By MIT license

更新履歴

Change Log

2.0.0-beta.3 (April 9, 2021)

Release candidate N2.3:

  • Move core-js from dev to runtime dependencies (closes #28, #29)

2.0.0-beta.2 (April 1, 2021)

Release candidate N2.2:

2.0.0-beta.1 (December 12, 2019)

Release candidate N2.1:

  • Update for CSSO 4
  • Drop maintenance for NODE < 8.0.0 (see csso v4 release notes, it's incompatible)

Resolved: #15, #16, #22.

Chores:

  • use native async/await instead async
  • moved to source-map with support WEBAssembly
  • Up-to-date dev-dependencies versions

1.0.0-beta.12 (April 4, 2018)

Release candidate N9:

  • Fix warning with webpack 4.x (thanks for @the-spyke):
    DeprecationWarning: Tapable.plugin is deprecated. Use new API on `.hooks` instead

1.0.0-beta.11 (April 4, 2018)

  • No changes

1.0.0-beta.10 (November 4, 2017)

Release candidate N8:

  • Add new option for two different files — pluginOutputPostfix
  • csso 3.3.0 -> 3.4.0 by default
  • Update-to-date dev-dependencies versions

1.0.0-beta.9 (October 17, 2017)

Release candidate N7:

  • csso 3.2.0 -> 3.3.0 by default
  • Update-to-date dev-dependencies versions

1.0.0-beta.8 (August 28, 2017)

Release candidate N6:

  • Update-to-date dependencies versions
  • BREAKING: options.sourceMap is deprecate and should be removed from config. For getting source map just use any value devtool.

1.0.0-beta.7 (June 3, 2017)

Release candidate N5:

  • Trivial; strict 0.10 node version
  • Update-to-date dependencies versions

1.0-beta.6 (April 17, 2017)

Release candidate N4

  • trivial. Provide typings for Flow and Typescript

1.0-beta.5 (April 15, 2017)

Release candidate N3

  • Fix issue with regexp filters

1.0-beta.4 (April 10, 2017)

Release candidate N2

  • Add output.sourceMapFilename options support

1.0-beta.3 (April 9, 2017)

Release candidate N1

  • Bugfix: simple compilation config triggered success callback twice

Breaking changes

  • The sourceMap:true used devtool option if chunk detection unexpected
  • nodejs is less than version 4 still can be used but isn't tested now.

1.0-beta.2 (March 31, 2017)

Strict source map type from options

  • options.sourceMap is enum and required for generate source maps.
  • Add strong dependencies for yarn package manager.

1.0-beta.1 (March 30, 2017)

Source Maps feature supported

  • Initial source map feature implementation
  • Update-to-date dependencies versions

1.0-alpha.4 (March 7, 2017)

Acknowledgements and regex filter

  • Add “Acknowledgements” section to README.md
  • Single argument regex typed should be filter

1.0-alpha.3 (March 6, 2017)

Documentation and draft filter API improves

  • Add more additional information about motivation
  • Filter function may be single now: new CSSOCompressPlugin(file => file.startsWith('foo'))

1.0-alpha (March 6, 2017)

Simple draft for minify css bundles with full restructing rules by csso.

No source maps No exception pretty print No anything else except basic minify