postcss-delete-duplicate-css

1.0.0 • Public • Published

Postcss Delete Duplicate Css PostCSS

中文: README-cn.md

PostCSS plugin for delete duplicate css in the file.

This plugin will not change the original css file, but delete the duplicate styles when packaging

Write this:

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

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

And get this:

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

Installation

$ npm install postcss-delete-duplicate-css

Usage

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

See PostCSS docs for examples regarding usage.

Options

isRemoveNull

  • Type: boolean
  • Default: false

Whether to delete empty styles

Write this:

  .foo {
    width: 100px;
  }

  div {}

And get this:

  .foo{
    width: 100px
  }

isRemoveComment

  • Type: boolean
  • Default: false

Whether to delete all comments

Write this:

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

And get this:

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

Testing

Tests can be run via the following command:

$ npm run test

Package Sidebar

Install

npm i postcss-delete-duplicate-css

Weekly Downloads

94

Version

1.0.0

License

MIT

Unpacked Size

12 kB

Total Files

14

Last publish

Collaborators

  • bdoo
  • duowb