Skip to content

Latest commit

 

History

History
118 lines (84 loc) · 2.07 KB

README-cn.md

File metadata and controls

118 lines (84 loc) · 2.07 KB

Postcss Delete Duplicate Css PostCSS

PostCSS 可以删除文件中重复的css.

此插件不会改变原始的css文件,只是在打包的时候会删除重复的样式

这样写:

.foo {
  width: 100px;
  height: 100px;
}

.foo{
  height: 100px;
  width: 100px;
}

变成这样:

.foo {
  width: 100px;
  height: 100px;
}

安装方式

$ npm install postcss-delete-duplicate-css

使用方式

postcss([ require('postcss-delete-duplicate-css') ])

查看 PostCSS 文档 examples regarding usage.

参数

isRemoveNull

  • Type: boolean
  • Default: false

是否删除空的样式

这样写:

  .foo {
    width: 100px;
  }

  div {}

变成这样:

  .foo{
    width: 100px
  }

isRemoveComment

  • Type: boolean
  • Default: false

是否删除所有的注释

这样写:

/*This is the comment*/
 div {
   width: 100px;
   height: 100px;
 }

变成这样:

 div {
   width: 100px;
   height: 100px
 }

测试

可以通过以下命令运行测试:

$ npm run test