lepu-test-platform-web/node_modules/postcss-discard-unused
zhangbo db3ebd0df0 把之前百度云的代码移植过来 2024-01-03 15:23:47 +08:00
..
dist 把之前百度云的代码移植过来 2024-01-03 15:23:47 +08:00
node_modules 把之前百度云的代码移植过来 2024-01-03 15:23:47 +08:00
CHANGELOG.md 把之前百度云的代码移植过来 2024-01-03 15:23:47 +08:00
LICENSE-MIT 把之前百度云的代码移植过来 2024-01-03 15:23:47 +08:00
README.md 把之前百度云的代码移植过来 2024-01-03 15:23:47 +08:00
package.json 把之前百度云的代码移植过来 2024-01-03 15:23:47 +08:00

README.md

postcss-discard-unused Build Status NPM version Dependency Status

Discard unused counter styles, keyframes and fonts.

Install

With npm do:

npm install postcss-discard-unused --save

Example

This module will discard unused at rules in your CSS file, if it cannot find any selectors that make use of them. It works on @counter-style, @keyframes and @font-face.

Input

@counter-style custom {
    system: extends decimal;
    suffix: "> "
}

@counter-style custom2 {
    system: extends decimal;
    suffix: "| "
}

a {
    list-style: custom
}

Output

@counter-style custom {
    system: extends decimal;
    suffix: "> "
}

a {
    list-style: custom
}

Note that this plugin is not responsible for normalising font families, as it makes the assumption that you will write your font names consistently, such that it considers these two declarations differently:

h1 {
    font-family: "Helvetica Neue"
}

h2 {
    font-family: Helvetica Neue
}

However, you can mitigate this by including postcss-minify-font-values before this plugin, which will take care of normalising quotes, and deduplicating. For more examples, see the tests.

Usage

See the PostCSS documentation for examples for your environment.

API

discardUnused([options])

options

fontFace

Type: boolean
Default: true

Pass false to disable discarding unused font face rules.

counterStyle

Type: boolean
Default: true

Pass false to disable discarding unused counter style rules.

keyframes

Type: boolean
Default: true

Pass false to disable discarding unused keyframe rules.

namespace

Type: boolean
Default: true

Pass false to disable discarding unused namespace rules.

Contributors

Thanks goes to these wonderful people (emoji key):


Ben Briggs

💻 📖 👀 ⚠️

Bogdan Chadkin

💻 📖 👀 ⚠️

Paweł Lesiecki

💻 ⚠️

Thomas McDonald

💻 ⚠️

This project follows the all-contributors specification. Contributions of any kind welcome!

License

MIT © Ben Briggs