Skip to content

duowb/postcss-delete-duplicate-css

Repository files navigation

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

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published