Socket
Socket
Sign inDemoInstall

clean-css-loader

Package Overview
Dependencies
81
Maintainers
1
Versions
25
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    clean-css-loader

CleanCSS loader module for webpack


Version published
Weekly downloads
6.7K
increased by1.16%
Maintainers
1
Install size
1.25 MB
Created
Weekly downloads
 

Changelog

Source

4.2.1

  • Fix passing loader options when using this.getOptions() from webpack 5.x.x

    import "clean-css-loader?skipWarn=true!./style.css"; 
    // {skipWarn: true  } loader-utils@2.x.x
    // {skipWarn: 'true'} webpack@5.x.x, unexpected behavior :(
    

    loader-utils has specific behavior for parsing query strings (true, false and null won't be parsed as string but as a primitive value)

Readme

Source
clean-css logo

A clean-css loader for webpack.

clean-css-loader

npm CI clean-css-loader install size npm clean-css-loader

Getting Started

To begin, you'll need to install clean-css-loader:

yarn add -D clean-css-loader

Then add the plugin to your webpack config. For example:

// webpack.config.js
const isProduction = process.env.NODE_ENV === "production";

module.exports = {
  module: {
    rules: [
      {
        test: /\.css$/,
        use: [
          "style-loader",
          "css-loader",
          {
            loader: "clean-css-loader",
            options: {
              // Loader options
              disable: !isProduction,
              skipWarn: false,

              // CleasCSS options
              compatibility: "ie9",
              level: 2,
              inline: ["remote"],
              //...
            },
          },
        ],
      },
    ],
  },
};

Or using plugin inline:

// default
import "style-loader!css-loader!clean-css-loader!./style.css";
// with options
import "style-loader!css-loader!clean-css-loader?level=2!./style.css";

Options

disable: boolean

This option enables/disables minify, useful to easily disable on development mode (default: false)

skipWarn: boolean

This option enables/disables output warnings (default: false)

sourceMap: boolean

Enables/Disables generation of source maps. (default: compiler.devtool)

CleanCSS module options

Keywords

FAQs

Last updated on 08 Jan 2023

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc