pug-strip-comments
Strip comments from a Pug token stream (from the lexer)
Last updated 7 years ago by pug-bot .
MIT · Repository · Original npm · Tarball · package.json
$ npm install pug-strip-comments 
SYNC missed versions from official npm registry.

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

Current Tags

  • 2.0.0-canary-2                                ...           canary (7 years ago)
  • 2.0.0                                ...           latest (7 years ago)

9 Versions

  • 2.0.0                                ...           7 years ago
  • 2.0.0-canary-2                                ...           7 years ago
  • 2.0.0-canary-1                                ...           7 years ago
  • 1.0.4                                ...           7 years ago
  • 1.0.3                                ...           9 years ago
  • 1.0.2                                ...           10 years ago
  • 1.0.1                                ...           10 years ago
  • 0.0.1                                ...           11 years ago
  • 0.0.0                                ...           11 years ago
Downloads
Total 23
Today 0
This Week 0
This Month 11
Last Day 0
Last Week 8
Last Month 8
Dependencies (1)
Dev Dependencies (1)
Dependents (2)

© 2010 - cnpmjs.org x YWFE | Home | YWFE