Skip to content

pugjs/pug-source-gen

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

pug-source-gen

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

Build Status Dependency Status NPM version

Installation

npm install pug-source-gen

Usage

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

About

Generate Pug source from a Pug AST.

Resources

License

Stars

Watchers

Forks

Packages

No packages published