postcss-optional-comments

1.0.2 • Public • Published

postcss-optional-comments postcss-optional-comments CircleCI Project postcss-optional-comments on NPM

Support for conditional comments using PostCSS.

What does this do?

This plugin allows you to choose which comments will appear in your css output using a simple not operator, /*!, in the opening syntax of a CSS comment.

Example

input.css:

/*! This comment will be removed! */
/* This comment will be kept! */
a {}

output.css:

/* This comment will be kept! */
a {}

Installation

postcss-optional-comments is freely available to download from github or install via NPM.

Install using NPM:

npm i --save-dev postcss-optional-comments

Usage

Gulp

Use with gulp-postcss module.

gulp.task('css', function () {
  var postcss          = require('gulp-postcss');
  var optionalComments = require('postcss-optional-comments');
 
  return gulp.src('./src/**/*.css')
    .pipe(postcss([ optionalComments ]))
    .pipe(gulp.dest('./dest'));
});

Todo

  • Support single line comments

Contributing

Feel free to submit a pull request!

Dependents (2)

Package Sidebar

Install

npm i postcss-optional-comments

Weekly Downloads

7

Version

1.0.2

License

MIT

Last publish

Collaborators

  • codetheory