Socket
Socket
Sign inDemoInstall

postcss-discard-unused

Package Overview
Dependencies
Maintainers
2
Versions
49
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

postcss-discard-unused

Discard unused counter styles, keyframes and fonts.


Version published
Weekly downloads
737K
increased by1.31%
Maintainers
2
Weekly downloads
 
Created
Source

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-font-family][fontfam] 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.

Contributing

Pull requests are welcome. If you add functionality, then please add unit tests to cover it.

License

MIT © Ben Briggs

Keywords

FAQs

Package last updated on 13 Aug 2015

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc