/
package.json
executable file
·34 lines (34 loc) · 3.53 KB
/
package.json
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
{
"author": {
"name": "Robert Sköld",
"email": "robert@publicclass.se",
"url": "http://publicclass.se"
},
"name": "express-partials",
"description": "Express 3.x Layout & Partial support.",
"version": "0.0.6",
"repository": {
"url": "https://github.com/publicclass/express-partials"
},
"engines": {
"node": "*"
},
"dependencies": {},
"devDependencies": {
"express": "3.0.0beta4",
"methods": "*",
"mocha": "*",
"should": "*",
"ejs": "*",
"jade": "*",
"eco": "*",
"coffeecup": "*",
"consolidate": "*"
},
"scripts": {
"test": "mocha -r should"
},
"readme": "[![build status](https://secure.travis-ci.org/publicclass/express-partials.png)](http://travis-ci.org/publicclass/express-partials)\n# express-partials\n\nExpress 3.x Layout & Partial support.\n\nThe beloved feature from Express 2.x is back as a middleware!\n\n\n## Installation\n\n $ npm install express-partials\n\n\n## Usage\n\nThe simple case:\n \n```javascript\nvar express = require('express')\n , partials = require('express-partials')\n , app = express();\n\n// load the express-partials middleware\napp.use(partials());\n\napp.get('/',function(req,res,next){\n res.render('index.ejs') \n // -> render layout.ejs with index.ejs as `body`.\n})\n\napp.get('/no-layout',function(req,res,next){\n res.render('index.ejs',{layout:false})\n // -> only renders index.ejs\n})\n\napp.get('/mobile',function(req,res,next){\n res.render('index.ejs',{layout:'mobile'})\n // -> render mobile.ejs with index.ejs as `body`.\n})\n```\n\nBy default express-partials tries to figure the engine out by using the extension of the template. But in special cases an extension can be registered. And this can be done in a few ways:\n\n```javascript\n// a function\npartials.register('.j',require('jade').render); \n\n// module (or object with a .render() function)\npartials.register('.j',require('jade')); \n\n// string (= require(str))\npartials.register('.j','jade'); \n```\n\n## Template Support\n\nAny synchronous template engine should work fine. But check out the [tests](./test/test.partials.js) for a few engines tested.\n\n\n## TODO\n\n - Async template engines?\n\n\n## Running Tests\n\nTo run the test suite first install dependencies with the following command within the repo:\n\n $ npm install\n\nthen run the tests:\n\n $ npm test\n\n\n## License \n\n(The MIT License)\n\nCopyright (c) 2012 Robert Sköld <robert@publicclass.se>\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.",
"_id": "express-partials@0.0.6",
"_from": "express-partials"
}