Skip to content

🔨移除没有使用到的css选择器

Notifications You must be signed in to change notification settings

careteenL/remove-uncss-webpack-plugin

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

remove-uncss-webpack-plugin

a webpack plugin to shake unused css code


how to use

npm install remove-uncss-webpack-plugin -D

config it in your webpack configuration file, it depends on extracting styles to a file, so please use ExtractTextPlugin first.

var ExtractTextPlugin = require('extract-text-webpack-plugin')
const CssTreeShakingPlugin = require("remove-uncss-webpack-plugin")

module.exports = {
  plugins: [
    new CssTreeShakingPlugin({
      remove: false,
      ignore: ['state-\d']
    }),
    new ExtractTextPlugin({
      filename: 'build/style.css'
    })
  ]
};

configuration

property type default discription
remove boolean false whether to remove unused css
ignore array [] items can be a string or a regexp

architechture

Examples

About

🔨移除没有使用到的css选择器

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published