JSPM

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

Strip comments from code. Remove both line comments and block comments.

Package Exports

  • strip-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-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-comments NPM version

Strip comments from code. Remove both line comments and block comments.

Should work with any language that uses the same syntax, e.g. JavaScript, LESS, SASS/SCSS, CSS.

Install

npm

 npm i strip-comments --save

bower

 npm install strip-comments --save

Usage

var strip = require('strip-comments');

all comments

strip( str );

Removes

// This comment

and

/**
 * this
 * comment
 */
var foo = function(/* and these */) {}

line comments

strip.line( str );

Removes

// This comment

Not

/**
 * this
 * comment
 */
var foo = function(/* and these */) {}

block comments

strip.block( str );

Removes

/**
 * this
 * comment
 */
var foo = function(/* and these */) {}

Not

// This comment

Tests

mocha -R spec

Author

Jon Schlinkert

License

Copyright (c) 2014 Jon Schlinkert, contributors. Released under the MIT license