1.0.0 • Published 3 years ago

postcss-delete-duplicate-css v1.0.0

Weekly downloads
-
License
MIT
Repository
github
Last release
3 years ago

Postcss Delete Duplicate Css

中文: 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