0.0.1 • Published 9 years ago

jade-source-gen v0.0.1

Weekly downloads
1
License
MIT
Repository
github
Last release
9 years ago

jade-source-gen

Generate Jade sources from a Jade AST. The resultant source may be different from the original Jade source, but the rendered output should be the same.

Build Status Dependency Status NPM version

Installation

npm install jade-source-gen

Usage

var lex = require('jade-lexer');
var parse = require('jade-parser');
var genSource = require('jade-source-gen');

var source = `
include a

mixin myMixin(arg)
  block
  p&attributes(attributes) Paragraph: #[strong= arg]

html
  head
  body
    p.klass(attr falseattr=false class=['myClass']) Introduction
    +myMixin('Content').klass2
      h1 Heading
`;
var ast = parse(lex(source));

var generatedSource = genSource(ast);
// =>
// include a
// mixin myMixin(arg)
//   block
//   p&attributes(attributes) Paragraph: #[strong= arg]
// html
//   head
//   body
//     p.klass(attr falseattr=false class=['myClass']) Introduction
//     +myMixin('Content').klass2
//       h1 Heading

License

MIT