Skip to content
This repository has been archived by the owner on Sep 30, 2020. It is now read-only.

PostCSS plugin that removes selectors from your CSS.

License

Notifications You must be signed in to change notification settings

ShogunPanda-archive/postcss-remove-selectors

Repository files navigation

postcss-remove-selectors

END OF DEVELOPMENT NOTICE - This package has been discontinued

PostCSS plugin that removes selectors from your CSS.

Usage

To use it, simply create a new instance of the plugin passing a list of selectors you want to be removed from your CSS.

Entries of the list can be either strings or regular expression. In both cases, search will match all selectors starting with the selector.

If a rule matches only that selector, the rule will be removed entirely, otherwise only the matching selector will be removed.

Example

Given this plugin configuration:

const fs = require('fs')
const postcss = require('postcss')
const removeSelectors = require('postcss-remove-selectors')

const css = fs.readFileSync('input.css', 'utf8')
const output = postcss()
  .use(removeSelectors({ selectors: ['a'] }))
  .process(css).css

the following CSS

strong,
a {
  font-weight: bold;
}

a {
  color: red;
}

will be transformed to this CSS

strong {
  font-weight: bold;
}

Supported implementations.

postcss-remove-selectors supports and has been tested on NodeJS 6.0+.

Contributing to postcss-remove-selectors

  • Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet.
  • Check out the issue tracker to make sure someone already hasn't requested it and/or contributed it.
  • Fork the project.
  • Start a feature/bugfix branch.
  • Commit and push until you are happy with your contribution.
  • Make sure to add tests for it. This is important so I don't break it in a future version unintentionally.

Copyright

Copyright (C) 2017 and above Shogun mailto:shogun@cowtech.it.

Licensed under the MIT license, which can be found at https://choosealicense.com/licenses/mit.

About

PostCSS plugin that removes selectors from your CSS.

Resources

License

Stars

Watchers

Forks

Packages

No packages published