{"name":"htmling","version":"0.0.2","description":"Polymer compatible HTML5 based templating syntax for node.js.","main":"lib/index.js","directories":{"test":"test"},"scripts":{"test":"mocha","watch":"npm run peg && mocha -- watch","peg":"pegjs ./src/parser.pegjs ./lib/parser.js","jshint":"jshint ./lib","pretest":"npm run peg && npm run jshint","coverage":"./node_modules/istanbul/lib/cli.js cover ./node_modules/mocha/bin/_mocha"},"bin":{"htmling":"./bin/htmling"},"repository":{"type":"git","url":"https://github.com/codemix/htmling"},"keywords":["html","template","html5","view","polymer"],"author":{"name":"Charles Pick","email":"charles@codemix.com"},"license":"MIT","bugs":{"url":"https://github.com/codemix/htmling/issues"},"homepage":"https://github.com/codemix/htmling","devDependencies":{"expect.js":"~0.3.1","pegjs":"~0.8.0","should":"~4.0.4","mocha":"~1.20.1","istanbul":"~0.2.11","bluebird":"~2.1.2","jshint":"~2.5.1"},"dependencies":{"estraverse":"~1.5.0","escodegen":"~1.3.3","yargs":"~1.2.3","mkdirp":"~0.5.0","classing":"0.0.9"},"_id":"htmling@0.0.2","dist":{"shasum":"f7f1d7f326e5746018e9b223d9c169826a367bc5","tarball":"http://registry-npm.ywwl.com/htmling/download/htmling-0.0.2.tgz","integrity":"sha512-XKB6v+GBdJWuksIjzZpTMKqMT/na8nRdqVf8fl5vJqkM0LMp8YoDZE3CxNt3iRG+zT8DzmXgk85qgsBXKuR3TQ==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDxlJxcTIsqYCOebChXrw4oeeEjFdiwErCOEkqNgCfknQIhAN6TQ+BbqmjPtCXWJsWV4KATSO0IvIKK906/SekJZsQg"}],"size":51550,"noattachment":false,"key":"/htmling/-/htmling-0.0.2.tgz"},"_from":".","_npmVersion":"1.3.24","_npmUser":{"name":"codemix","email":"charles@codemix.com"},"maintainers":[{"name":"codemix","email":"charles@codemix.com"}],"readme":"# HTMLing\n\n[![Build Status](https://travis-ci.org/codemix/htmling.svg?branch=master)](https://travis-ci.org/codemix/htmling)\n\n[Polymer](http://polymer-project.org/) compatible HTML5 based templating syntax for node.js.\nRender your templates server-side using the same syntax as in the browser, with no virtual DOM trickery required.\n\nFor a full demonstration, please see [htmling-demo-app](https://github.com/codemix/htmling-demo-app).\n\n## Installation\n\nvia [npm](https://npmjs.org/package/htmling)\n\n```\nnpm install htmling\n```\n\n## Example\n\nTurns this:\n\n```html\n<!doctype html>\n<html>\n  <head>\n    <title>{{title}}</title>\n    <meta name=\"description\" content=\"{{description}}\">\n  </head>\n  <body>\n    <h1>{{title}}</h1>\n    <ul>\n    <template repeat=\"{{user in users}}\">\n      <li>{{user.name}}</li>\n    </template>\n    </ul>\n  </body>\n</html>\n```\n\nplus this:\n\n```json\n{\n  \"title\": \"User List\",\n  \"description\": \"A list of users\",\n  \"users\": [\n    {\n      \"name\": \"Alice\"\n    },\n    {\n      \"name\": \"George\"\n    }\n  ]\n}\n```\n\ninto this:\n\n```html\n<!doctype html>\n<html>\n  <head>\n    <title>User List</title>\n    <meta name=\"description\" content=\"A list of users\">\n  </head>\n  <body>\n    <h1>User List</h1>\n    <ul>\n      <li>Alice</li>\n      <li>George</li>\n    </ul>\n  </body>\n</html>\n```\n\n\n\n## How it works\n\nUnlike similar libraries, HTMLing does not require a virtual DOM such as jsDOM. Instead, HTMLing\nparses `.html` files and transforms them into very efficient executable JavaScript functions.\nIt uses a [parser](./src/parser.pegjs) written in [PEG.js](https://github.com/dmajda/pegjs) which emits a standard [Mozilla Parser API](https://developer.mozilla.org/en-US/docs/Mozilla/Projects/SpiderMonkey/Parser_API) [AST](http://en.wikipedia.org/wiki/Abstract_syntax_tree) with some custom node types. The [compiler](./lib/compiler.js) then uses [estraverse](https://github.com/Constellation/estraverse) to convert these custom node types to standard JavaScript expressions. Finally, the result is passed to [escodegen](https://github.com/Constellation/escodegen) which converts the AST into executable JavaScript.\n\nThis compilation process happens only once, and the resulting JavaScript is extremely efficient.\n\n\n## Usage\n\nHTMLing is easy to integrate with your existing build process, either via the command line or library interfaces.\n\n## CLI\n\nHTMLing ships with a small command line interface:\n\n### Compile an individual file\nThe compiled output will be written to STDOUT\n\n```\nhtmling ./file.html\n```\n\n\n### Compile an individual file to a destination\nThe compiled output will be written to `compiled.js`.\n\n```\nhtmling -o ./compiled.js ./file.html\n```\n\n### Compile a directory hierarchy\nCompile a nested directory structure to a directory called `compiled`. The output\ndirectory will be created if it does not already exist, and the resulting folder structure will\nmatch that of the input.\n\n```\nhtmling -o ./compiled ./pages\n```\n\n### Compile a directory hierarchy to a single file\nCompile a nested directory structure to a single called `compiled.js`\n\n```\nhtmling -c -o ./compiled.js ./pages\n```\n\n\n## As a Library\n\nIt's also possible to use HTMLing as a library:\n\n### Compile a string\n\n```js\nvar HTMLing = require('htmling');\n\nvar template = HTMLing.string('Hello {{name}}');\n\nconsole.log(template.render({name: 'Charles'})); // \"Hello Charles\"\n```\n\n### Compile a file\n\n```js\nvar template = HTMLing.file('./index.html');\nconsole.log(template.render());\n```\n\n### Compile a directory\n\n```js\nvar templates = HTMLing.dir('./pages');\nconsole.log(templates.render('index.html', {}))\n```\n\n### Using as an express view engine\n\nHTMLing has support for [express.js](http://expressjs.com/).\n\n```js\nvar HTMLing = require('htmling');\napp.configure(function(){\n  app.engine('html', HTMLing.express(__dirname + '/views/'));\n  app.set('view engine', 'html');\n});\n```\n\nIn development mode, you'll probably want to enable the `watch` option. This will reload your\ntemplates when they change on disk:\n\n```js\nvar HTMLing = require('htmling');\napp.configure(function(){\n  app.engine('html', HTMLing.express(__dirname + '/views/', {watch: true}));\n  app.set('view engine', 'html');\n});\n```\n\n## License\n\nMIT, see [LICENSE.md](./LICENSE.md).\n\n## Docker environment\n\nAll you need is [Docker](https://www.docker.com/) with `docker-compose` available from your terminal.\n\n\nWe have a fancy shortcut to get your application up and running, and you also get access to the container terminal:\n\n```console\n$ make build\n$ make run\n```\n\nFrom this point, it's just a matter of starting the application from within the container shell:\n\n```console\nhtmling:~/app(master)$ npm test\n```\n\n#### Other fancy shortcuts we have for Docker fans\n\n* `$ make in` to open a new container terminal\n* `$ make stop` to stop all containers\n* `$ make clean` to clean the Docker environment\n","publish_time":1403093694249,"_cnpm_publish_time":1403093694249,"dist-tags":{"latest":"0.0.8"}}