Arquivos
2013-08-10 13:15:52 +01:00

57 linhas
6.6 KiB
JSON

{
"name": "consolidate",
"version": "0.9.1",
"description": "Template engine consolidation library",
"keywords": [
"template",
"engine",
"view"
],
"author": {
"name": "TJ Holowaychuk",
"email": "tj@vision-media.ca"
},
"devDependencies": {
"mocha": "*",
"should": "*",
"jade": "0.26.0",
"ejs": "0.7.1",
"eco": "1.1.0-rc-3",
"swig": "0.12.0",
"jazz": "0.0.18",
"jqtpl": "1.1.0",
"liquor": "0.0.4",
"hamljs": "0.6.1",
"whiskers": "0.2.2",
"haml-coffee": "1.4.0",
"hogan.js": "2.0.0",
"dust": "0.3.0",
"dustjs-linkedin": "1.2",
"dustjs-helpers": "1.1.1",
"handlebars": "1.0.7",
"underscore": "1.3.3",
"qejs": "0.0.1",
"walrus": "0.9.0",
"mustache": "0.4.0",
"just": "0.1.8",
"ect": "0.3.5",
"mote": "0.2.0",
"toffee": "0.0.52",
"atpl": ">=0.5.5",
"templayed": ">=0.2.3",
"dot": "1.0.1"
},
"main": "index",
"scripts": {
"test": "mocha"
},
"readme": "# Consolidate.js\n\n Template engine consolidation library.\n\n## Installation\n\n $ npm install consolidate\n\n## Supported template engines\n\n - [atpl](https://github.com/soywiz/atpl.js)\n - [dust](https://github.com/akdubya/dustjs) [(website)](http://akdubya.github.com/dustjs/)\n - [eco](https://github.com/sstephenson/eco)\n - [ect](https://github.com/baryshev/ect) [(website)](http://ectjs.com/)\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 - [JUST](https://github.com/baryshev/just)\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 - [templayed](http://archan937.github.com/templayed.js/)\n - [toffee](https://github.com/malgorithms/toffee)\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__NOTE__: you must still install the engines you wish to use, add them to your package.json dependencies.\n\n## API\n\n All templates supported by this library may be rendered using the signature `(path[, locals], callback)` as shown below, which happens to be the signature that Express 3.x supports so any of these engines may be used within Express.\n\n__NOTE__: All this example code uses cons.swig for the swig template engine. Replace swig with whatever templating you are using. For exmaple, use cons.hogan for hogan.js, cons.jade for jade, etc. `console.log(cons)` for the full list of identifiers.\n\n```js\nvar cons = require('consolidate');\ncons.swig('views/page.html', { user: 'tobi' }, function(err, html){\n if (err) throw err;\n console.log(html);\n});\n```\n\n Or without options / local variables:\n\n```js\nvar cons = require('consolidate');\ncons.swig('views/page.html', function(err, html){\n if (err) throw err;\n console.log(html);\n});\n```\n\n To dynamically pass the engine, simply use the subscript operator and a variable:\n\n```js\nvar cons = require('consolidate')\n , name = 'swig';\n\ncons[name]('views/page.html', { user: 'tobi' }, function(err, html){\n if (err) throw err;\n console.log(html);\n});\n```\n\n## Caching\n\n To enable caching simply pass `{ cache: true }`. Engines _may_ use this option to cache things reading the file contents, compiled `Function`s etc. Engines which do _not_ support this may simply ignore it. All engines that consolidate.js implements I/O for will cache the file contents, ideal for production environments.\n\n```js\nvar cons = require('consolidate');\ncons.swig('views/page.html', { user: 'tobi' }, function(err, html){\n if (err) throw err;\n console.log(html);\n});\n```\n\n## Express 3.x example\n\n```js\nvar express = require('express')\n , cons = require('consolidate')\n , app = express();\n\n// assign the swig engine to .html files\napp.engine('html', cons.swig);\n\n// set .html as the default extension \napp.set('view engine', 'html');\napp.set('views', __dirname + '/views');\n\nvar users = [];\nusers.push({ name: 'tobi' });\nusers.push({ name: 'loki' });\nusers.push({ name: 'jane' });\n\napp.get('/', function(req, res){\n res.render('index', {\n title: 'Consolidate.js'\n });\n});\n\napp.get('/users', function(req, res){\n res.render('users', {\n title: 'Users',\n users: users\n });\n});\n\napp.listen(3000);\nconsole.log('Express server listening on port 3000');\n```\n\n## Running tests\n\n Install dev deps:\n \n $ npm install -d\n\n Run the tests:\n\n $ make test\n\n## License \n\n(The MIT License)\n\nCopyright (c) 2011 TJ Holowaychuk <tj@vision-media.ca>\n\nPermission is hereby granted, free of charge, to any person obtaining\na copy of this software and associated documentation files (the\n'Software'), to deal in the Software without restriction, including\nwithout limitation the rights to use, copy, modify, merge, publish,\ndistribute, sublicense, and/or sell copies of the Software, and to\npermit persons to whom the Software is furnished to do so, subject to\nthe following conditions:\n\nThe above copyright notice and this permission notice shall be\nincluded in all copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,\nEXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\nMERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.\nIN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY\nCLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,\nTORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\nSOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n",
"readmeFilename": "Readme.md",
"_id": "consolidate@0.9.1",
"dist": {
"shasum": "61e5d83c1434664fa3a339986817a2be99102931"
},
"_from": "consolidate@",
"_resolved": "https://registry.npmjs.org/consolidate/-/consolidate-0.9.1.tgz"
}