JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 48361
  • Score
    100M100P100Q163833F
  • License MIT

Strip comments from CSS

Package Exports

  • strip-css-comments

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (strip-css-comments) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

strip-css-comments Build Status

Strip comments from CSS

Also available as a gulp/grunt/broccoli plugin.

Usage

$ npm install --save strip-css-comments
var stripCssComments = require('strip-css-comments');

// by default important comments `/*!` are preserved
stripCssComments('/*! <copyright> */ body { /* unicorns */color: hotpink; }');
//=> '/*! <copyright> */ body { color: hotpink; }'

// use the `all: true` option to strip everything
stripCssComments('/*! <copyright> */ body { /* unicorns */color: hotpink; }', {all: true});
//=> ' body { color: hotpink; }'

API

stripCssComments(input, [options])

input

Required
Type: string

String with CSS.

options

all

Type: boolean
Default: false

Whether important CSS comments (those starting with /*!) should be stripped.

CLI

$ npm install --global strip-css-comments
$ strip-css-comments --help

  Usage
    strip-css-comments <input-file> > <output-file>
    strip-css-comments < <input-string>

  Option
    -a, --all  Strip all comments including `/*!`

  Example
    strip-css-comments src/app.css > dist/app.css
    strip-css-comments < src/app.css --all

Benchmark

$ npm run bench

License

MIT © Sindre Sorhus