2.0.0 • Published 4 years ago
pug-strip-comments v2.0.0
pug-strip-comments
Strips comments from Pug token stream
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
2.0.0-canary-2
4 years ago
2.0.0
4 years ago
2.0.0-canary-1
5 years ago
1.0.4
5 years ago
1.0.3
7 years ago
1.0.2
8 years ago
1.0.1
8 years ago
0.0.1
9 years ago
0.0.0
9 years ago