postcss-remove-rules

PostCSS plugin to remove rules by selector.

Downloads in past

Stats

StarsIssuesVersionUpdatedCreatedSize
postcss-remove-rules
411.0.08 years ago8 years agoMinified + gzip package size for postcss-remove-rules in KB

Readme

PostCSS Remove Rules !Build Statusci-imgci
PostCSS plugin to remove rules by selector.

Installation

$ npm install postcss-remove-rules

Usage

// dependencies
var fs = require("fs")
var postcss = require("postcss")
var remove = require("postcss-remove-rules")

// css to be processed
var css = fs.readFileSync("input.css", "utf8")

// process css
var output = postcss()
  .use(remove({
    rulesToRemove: {
      '.my-class': '*' // Or an array of CSS rule props
    }
  }))
  .process(css)
  .css

Options

rulesToRemove

An object where each specified key is a CSS selector and each value is either '*'' indicating that all rules for that selector should be removed, a string matching the CSS property name to remove (e.g. 'font-style'), or an array of strings containing CSS properties to be removed (e.g. ['position', 'display']).
See PostCSS docs for examples for your environment.