uncommentify

A through stream that removes comments from js

uncommentify

A through stream that removes comments with falafel.

// Strip banner comments from js 
var strip = require('uncommentify')();
var fs = require('fs');
fs.createReadStream('index.js')
  .pipe(strip)
  .pipe(fs.createWriteStream('no-banner-comments.js'));
// Strip ALL comments from js 
var strip = require('uncommentify')({
  all: true,
});
var fs = require('fs');
fs.createReadStream('index.js')
  .pipe(strip)
  .pipe(fs.createWriteStream('no-comments.js'));

By default, uncommentify will just remove the first found banner comment.

/* I am 
a block
 * banner comment */
// I am  
// a line 
// banner comment 
/*! I will not be removed even though Im a banner comment unless you force me. */
var strip = require('uncommentify')({
  all: false,
  force: false,
  line: true,
  block: true,
});

Removes all comments.

Will remove comments that begin with /*! or //! which are not normally removed.

Set to false to not remove // line comments.

Set to false to not remove /* block */ comments.

  • 0.1.0 - initial release

MIT