UNPKG

grunt-templater

Version:

Universal template compiler task for Grunt.

58 lines (57 loc) 4.81 kB
{ "name": "grunt-templater", "description": "Universal template compiler task for Grunt.", "version": "0.0.7", "homepage": "https://github.com/rockwood/grunt-templater", "author": { "name": "Kevin Rockwood", "email": "kevin@rockwood.me" }, "repository": { "type": "git", "url": "git@github.com:rockwood/grunt-templater.git" }, "bugs": { "url": "https://github.com/rockwood/grunt-templater/issues" }, "licenses": [ { "type": "MIT", "url": "https://github.com/rockwood/grunt-template/blob/master/LICENSE-MIT" } ], "main": "grunt.js", "bin": { "grunt-templater": "bin/grunt-templater" }, "engines": { "node": ">=0.4.11" }, "dependencies": { "grunt": ">=0.3.7", "consolidate": ">=0.4.0", "es6-promise": "~1.0.0" }, "devDependencies": { "grunt": "~0.3.7", "consolidate": ">=0.4.0", "es6-promise": "~1.0.0" }, "keywords": [ "template", "jade", "ejs", "handlebars", "mustache", "grunt", "gruntplugin" ], "readme": "# grunt-templater\n\nUniversal template compiler task for Grunt. It uses [Consolidate](https://github.com/visionmedia/consolidate.js) under the hood.\n\n## Supported template engines\n\n - [dust](https://github.com/akdubya/dustjs) [(website)](http://akdubya.github.com/dustjs/)\n - [eco](https://github.com/sstephenson/eco)\n - [ejs](https://github.com/visionmedia/ejs)\n - [haml](https://github.com/visionmedia/haml.js) [(website)](http://haml-lang.com/)\n - [haml-coffee](https://github.com/9elements/haml-coffee) [(website)](http://haml-lang.com/)\n - [handlebars](https://github.com/wycats/handlebars.js/) [(website)](http://handlebarsjs.com/)\n - [hogan](https://github.com/twitter/hogan.js) [(website)](http://twitter.github.com/hogan.js/)\n - [jade](https://github.com/visionmedia/jade) [(website)](http://jade-lang.com/)\n - [jazz](https://github.com/shinetech/jazz)\n - [jqtpl](https://github.com/kof/node-jqtpl) [(website)](http://api.jquery.com/category/plugins/templates/)\n - [liquor](https://github.com/chjj/liquor)\n - [mustache](https://github.com/janl/mustache.js)\n - [QEJS](https://github.com/jepso/QEJS)\n - [swig](https://github.com/paularmstrong/swig) [(website)](http://paularmstrong.github.com/swig/)\n - [underscore](https://github.com/documentcloud/underscore) [(website)](http://documentcloud.github.com/underscore/)\n - [walrus](https://github.com/jeremyruppel/walrus) [(website)](http://documentup.com/jeremyruppel/walrus/)\n - [whiskers](https://github.com/gsf/whiskers.js/tree/)\n\n## Getting Started\n\ninstall via npm\n\n npm install grunt-templater\n\ninstall the template engine you intend to use. For example, if using Jade:\n\n npm install jade\n\nand in your grunt.js file:\n\n grunt.loadNpmTasks('grunt-templater');\n\n## Usage\n\nCreate a `template` task in your grunt config. Templater will guess the intended template engine based on the `src` filename. Pass the `engine` option to force a specific engine.\n\nWhen using the [Grunt file format](http://gruntjs.com/configuring-tasks#files), `variables` is required:\n\n grunt.initConfig({\n template: {\n all: {\n files: [{\n expand: true,\n cwd: 'source',\n src: [ '**/*.hbs' ],\n dest: 'build',\n ext: '.html'\n }],\n variables: {\n env: environment\n }\n }\n }\n });\n\nTo remain backwards compatible, `src`, `dest` can be used to define files aswell:\n\n grunt.initConfig({\n template: {\n dev: {\n src: 'app/homepage.jade',\n dest: 'dev.html',\n variables: {\n css_url: 'app.css'\n title: 'Hello World'\n pretty: true\n }\n },\n dist: {\n src: 'app/homepage.jade',\n dest: 'dist/index.html',\n variables: {\n css_url: 'app.min.css'\n title: 'Hello Production'\n }\n },\n dynamicVariables: {\n src: 'app/homepage.jade',\n dest: 'dist/index.html',\n variables: function () {\n return {\n css: grunt.file.read('app.min.css'),\n now: new Date()\n }\n }\n }\n },\n ...\n });\n\nrun with:\n\n grunt template\n\nor for a specific target:\n\n grunt template:dev\n\nEngine specific options can also be passed through the `variables` option. In the case of Jade, `pretty: true` adds pretty-indentation whitespace to its output.", "readmeFilename": "README.md", "repository": { "type": "git", "url": "git@github.com:rockwood/grunt-templater.git" }, "_id": "grunt-templater@0.0.5", "_from": "grunt-templater@" }