jade-walk

Walk and transform a jade AST

jade-walk will be unpublished soon, please use pug-walk
Last updated 5 years ago by timothygu .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install jade-walk 
SYNC missed versions from official npm registry.

jade-walk

Walk and transform a jade AST

Build Status Dependency Status NPM version

Installation

npm install jade-walk

Usage

var lex = require('jade-lexer');
var parse = require('jade-parser');
var walk = require('jade-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

Current Tags

  • 0.0.3                                ...           latest (5 years ago)

3 Versions

  • 0.0.3 [deprecated]           ...           5 years ago
  • 0.0.2 [deprecated]           ...           5 years ago
  • 0.0.1 [deprecated]           ...           5 years ago
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 1
Dependencies (0)
None
Dev Dependencies (2)

Copyright 2014 - 2016 © taobao.org |