Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/pugjs/pug-source-gen
Generate Pug source from a Pug AST.
https://github.com/pugjs/pug-source-gen
Last synced: 4 months ago
JSON representation
Generate Pug source from a Pug AST.
- Host: GitHub
- URL: https://github.com/pugjs/pug-source-gen
- Owner: pugjs
- License: mit
- Created: 2015-10-04T04:32:16.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2018-05-14T13:09:17.000Z (over 6 years ago)
- Last Synced: 2024-10-05T09:13:34.217Z (4 months ago)
- Language: JavaScript
- Homepage:
- Size: 13.7 KB
- Stars: 6
- Watchers: 6
- Forks: 4
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE.md
Awesome Lists containing this project
README
# 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](https://img.shields.io/travis/pugjs/pug-source-gen/master.svg)](https://travis-ci.org/pugjs/pug-source-gen)
[![Dependency Status](https://img.shields.io/gemnasium/pugjs/pug-source-gen.svg)](https://gemnasium.com/pugjs/pug-source-gen)
[![NPM version](https://img.shields.io/npm/v/pug-source-gen.svg)](https://www.npmjs.org/package/pug-source-gen)## Installation
npm install pug-source-gen
## Usage
```js
var lex = require('pug-lexer');
var parse = require('pug-parser');
var genSource = require('pug-source-gen');var source = `
include amixin 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