devsite/node_modules/pug-strip-comments
2024-07-07 18:49:38 -07:00
..
CHANGELOG.md more 2024-07-07 18:49:38 -07:00
index.js more 2024-07-07 18:49:38 -07:00
LICENSE.md more 2024-07-07 18:49:38 -07:00
package.json more 2024-07-07 18:49:38 -07:00
README.md more 2024-07-07 18:49:38 -07:00

pug-strip-comments

Strips comments from Pug token stream

Build Status Dependencies Status DevDependencies Status NPM version

Installation

npm install pug-strip-comments

Usage

var lex = require('pug-lexer');
var stripComments = require('pug-strip-comments');

var tokens = lex('//- unbuffered\n// buffered');
// [ { type: 'comment', line: 1, val: ' unbuffered', buffer: false },
//   { type: 'newline', line: 2 },
//   { type: 'comment', line: 2, val: ' buffered', buffer: true },
//   { type: 'eos', line: 2 } ]

// Only strip unbuffered comments (default)
stripComments(tokens, { filename: 'pug' });
// [ { type: 'newline', line: 2 },
//   { type: 'comment', line: 2, val: ' buffered', buffer: true },
//   { type: 'eos', line: 2 } ]

// Only strip buffered comments (when you want to play a joke on your coworkers)
stripComments(tokens, { filename: 'pug', stripUnbuffered: false, stripBuffered: true });
// [ { type: 'comment', line: 1, val: ' unbuffered', buffer: false },
//   { type: 'newline', line: 2 },
//   { type: 'eos', line: 2 } ]

// Strip both (if you want Pug VERY clean)
stripComments(tokens, { filename: 'pug', stripBuffered: true });
// [ { type: 'newline', line: 2 },
//   { type: 'eos', line: 2 } ]

License

MIT