Giter Club home page Giter Club logo

csso-webpack-plugin's Introduction

CSSO Webpack Plugin

npm node dependencies status downloads

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

Usage

Plugin good to use in pair with ExtractTextPlugin or MiniCssExtractPlugin.

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

module.exports = {
  module: { /* ... */ },
  plugins: [
    new ExtractTextPlugin('[name].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 MIT license

csso-webpack-plugin's People

Contributors

zoobestik avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.