GrauKatze 05f70669c9 Сконфигурирована и подготовлена база для проекта | пре 2 година | |
---|---|---|
.. | ||
CHANGELOG.md | пре 2 година | |
LICENSE.md | пре 2 година | |
README.md | пре 2 година | |
index.js | пре 2 година | |
package.json | пре 2 година |
Strips comments from Pug token stream
npm install pug-strip-comments
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 } ]
MIT