# pug-strip-comments

> Strip comments from a Pug token stream (from the lexer)

Latest version **2.0.0** (published 2020-05-25) · MIT license · 0 weekly downloads

## Install

```sh
npm install pug-strip-comments
pnpm add pug-strip-comments
yarn add pug-strip-comments
bun add pug-strip-comments
```

## Health

**Score 30/100 (F)** — status: abandoned.

Positive: no vulnerabilities; popular repo.

Warnings: low downloads; no types; no esm support.

Negative: abandoned.

## Facts

| | |
|---|---|
| Version | 2.0.0 |
| Published | 2020-05-25 |
| First published | 2015-12-04 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 5.8 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 21851 |
| Author | Timothy Gu |
| Maintainers | forbeslindesay, pug-bot, timothygu |
| Keywords | pug |

## Links

- npm: https://www.npmjs.com/package/pug-strip-comments
- Repository: https://github.com/pugjs/pug/tree/master/packages/pug-strip-comments
- npm.io page: https://npm.io/package/pug-strip-comments

## Dependencies (1)

- [pug-error](https://npm.io/package/pug-error.md) ^2.0.0

## Recent versions

- 2.0.0 (latest) — 2020-05-25
- 2.0.0-canary-2 (canary) — 2020-05-25
- 2.0.0-canary-1 — 2020-05-24
- 1.0.4 — 2019-06-18
- 1.0.3 — 2018-03-06
- 1.0.2 — 2017-01-24
- 1.0.1 — 2016-08-10
- 0.0.1 — 2015-12-12
- 0.0.0 — 2015-12-04

## README

# pug-strip-comments

Strips comments from Pug token stream

[![Build Status](https://img.shields.io/travis/pugjs/pug-strip-comments/master.svg)](https://travis-ci.org/pugjs/pug-strip-comments)
[![Dependencies Status](https://david-dm.org/pugjs/pug/status.svg?path=packages/pug-strip-comments)](https://david-dm.org/pugjs/pug?path=packages/pug-strip-comments)
[![DevDependencies Status](https://david-dm.org/pugjs/pug/dev-status.svg?path=packages/pug-strip-comments)](https://david-dm.org/pugjs/pug?path=packages/pug-strip-comments&type=dev)
[![NPM version](https://img.shields.io/npm/v/pug-strip-comments.svg)](https://www.npmjs.org/package/pug-strip-comments)

## Installation

    npm install pug-strip-comments

## Usage

```js
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

---
_Source: https://npm.io/package/pug-strip-comments · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
