Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/tobbbles/diet-jade
Jade template engine plugin for diet.js
https://github.com/tobbbles/diet-jade
Last synced: 13 days ago
JSON representation
Jade template engine plugin for diet.js
- Host: GitHub
- URL: https://github.com/tobbbles/diet-jade
- Owner: tobbbles
- License: mit
- Created: 2015-11-17T20:53:56.000Z (about 9 years ago)
- Default Branch: master
- Last Pushed: 2016-09-12T08:11:25.000Z (about 8 years ago)
- Last Synced: 2024-10-16T03:04:52.036Z (about 1 month ago)
- Language: JavaScript
- Homepage:
- Size: 2.93 KB
- Stars: 0
- Watchers: 1
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: license
Awesome Lists containing this project
README
# **diet-jade**
Jade template engine plugin for [diet][2] based on [Jade][1]. Support for sending data to view through `$.data.PARAM` and displayed via `#{PARAM}`.## **Learn about Jade**:
Learn how to use it at the engine's website:
- **Website:** [http://jade-lang.com/](http://jade-lang.com/)## **Install**
```
npm install diet-jade
```[![NPM](https://nodei.co/npm/diet-jade.png?downloads=true&downloadRank=true&stars=true)](https://nodei.co/npm/diet-jade/)
## **Example Usage**
**index.js**```js
// Require Diet server
var server = require('diet')
// Require diet-jade plugin
var jade = require('diet-jade')({path: app.path + '/static/jade/'})// Instantiate server
var app = server()
// Set server listening port
app.listen('http://localhost:8000')// Assign jade plugin to the header
app.header(jade)// Create a route
app.get('/', function($) {
// Render jade file! this will render ./yourConfiguredDirectory/index.jade
$.data.message = 'This is awesome!'
$.render('index')
})app.get('/profile', function ($) {
// Render jade file! this will render ./.../yourConfiguredDirectory/profile.jade
$.render('profile')
})
```**~/.../static/jade/index.jade**
```
p Received message: #{message}
```## **File Rendering**
```js
$.render('yourFile') // will serve yourConfiguredDirectory/yourFile.jade$.render('yourFile.jade') //wil serve yourConfiguredDirectory/yourFile.jade
```## **License**
Please refer to [The License](./license).[1]: http://jade-lang.com/
[2]: http://dietjs.com/