Skip to content

DIREKTSPEED-LTD/diet-pug

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

diet-pug

Pug template engine plugin for diet based on pug. Support for sending data to view through $.data.PARAM and displayed via #{PARAM}.

Learn about pug:

Learn how to use it at the engine's website:

Install

npm install diet-pug

NPM

Example Usage

index.js

// Require Diet server
var server = require('diet')
// Require diet-pug plugin
var pug = require('diet-pug')({path: app.path + '/static/pug/'})

// Instantiate server
var app = server()
// Set server listening port
app.listen('http://localhost:8000')

// Assign pug plugin to the header
app.header(pug)

// Create a route
app.get('/', function($) {
  // Render pug file! this will render ./yourConfiguredDirectory/index.pug
  $.data.message = 'This is awesome!'
  $.render('index')
})

app.get('/profile', function ($) {
  // Render pug file! this will render ./.../yourConfiguredDirectory/profile.pug
  $.render('profile')
})

~/.../static/pug/index.pug

p Received message: #{message}

File Rendering

$.render('yourFile') // will serve yourConfiguredDirectory/yourFile.pug

$.render('yourFile.pug') //wil serve yourConfiguredDirectory/yourFile.pug

License

Please refer to The License.

About

Jade template engine plugin for diet.js

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • JavaScript 100.0%