JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 2047749
  • Score
    100M100P100Q215482F
  • License MIT

Walk and transform a pug AST

Package Exports

  • pug-walk

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (pug-walk) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

pug-walk

Walk and transform a pug AST

Build Status Dependency Status npm version Coverage Status

Installation

npm install pug-walk

Usage

var lex = require('pug-lexer');
var parse = require('pug-parser');
var walk = require('pug-walk');

var ast = walk(parse(lex('.my-class foo')), function before(node, replace) {
  // called before walking the children of `node`
  // to replace the node, call `replace(newNode)`
  // return `false` to skip descending
  if (node.type === 'Text') {
    replace({ type: 'Text', val: 'bar', line: node.line });
  }
}, function after(node, replace) {
  // called after walking the children of `node`
  // to replace the node, call `replace(newNode)`
}, {includeDependencies: true});
assert.deepEqual(parse(lex('.my-class bar')), ast);

License

MIT