diet-jade

1.0.2 • Public • Published

diet-jade

Jade template engine plugin for diet based on Jade. 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:

Install

npm install diet-jade

NPM

Example Usage

index.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

$.render('yourFile') // will serve yourConfiguredDirectory/yourFile.jade
 
$.render('yourFile.jade') //wil serve yourConfiguredDirectory/yourFile.jade

License

Please refer to The License.

Package Sidebar

Install

npm i diet-jade

Weekly Downloads

2

Version

1.0.2

License

MIT

Last publish

Collaborators

  • mnzt