postcss-browser-comments
Keep only the CSS you need based on comments and your browserslist
Last updated 3 months ago by romainmenke .
MIT-0 · Repository · Bugs · Original npm · Tarball · package.json
$ npm install postcss-browser-comments 
SYNC missed versions from official npm registry.

PostCSS Browser Comments PostCSS Logo

npm install postcss-browser-comments --save-dev

PostCSS Browser Comments lets you keep only the CSS you need based on comments and your browserslist.

/**
 * Prevent adjustments of font size after orientation changes in IE and iOS.
 */

html {
  -ms-text-size-adjust: 100%;
  -webkit-text-size-adjust: 100%;
}

/* becomes */


The comment and rule above would be removed with the following browserslist:

last 2 chrome versions

The rule below would be more carefully altered:

/**
 * 1. Add the correct box sizing in Firefox.
 * 2. Show the overflow in Edge and IE.
 */

hr {
  box-sizing: content-box; /* 1 */
  height: 0; /* 1 */
  overflow: visible; /* 2 */
}

/* with a `last 2 firefox versions` browserslist becomes */

/**
 * 1. Add the correct box sizing in Firefox.
 * 2. Show the overflow in Edge and IE.
 */

hr {
  box-sizing: content-box; /* 1 */
  height: 0; /* 1 */
}

Usage

Add PostCSS Browser Comments to your project:

npm install postcss postcss-browser-comments --save-dev

Use it as a PostCSS plugin:

const postcss = require('postcss');
const postcssBrowserComments = require('postcss-browser-comments');

postcss([
	postcssBrowserComments(/* pluginOptions */)
]).process(YOUR_CSS /*, processOptions */);

Options

browsers

The browsers option overrides of the project’s browserslist.

postcssBrowserComments({ browsers: 'last 2 versions' })

Current Tags

  • 6.0.1                                ...           latest (3 months ago)

7 Versions

  • 6.0.1                                ...           3 months ago
  • 6.0.0                                ...           5 months ago
  • 5.0.0                                ...           7 months ago
  • 4.0.0                                ...           4 years ago
  • 3.0.0                                ...           6 years ago
  • 2.0.0                                ...           6 years ago
  • 1.0.0                                ...           7 years ago
Downloads
Total 2
Today 1
This Week 1
This Month 2
Last Day 0
Last Week 0
Last Month 0
Dependencies (0)
None
Dev Dependencies (0)
None
Dependents (1)

© 2010 - cnpmjs.org x YWFE | Home | YWFE