Learn about our RFC process, Open RFC meetings & more.Join in the discussion! »

diet-ejs

1.0.0 • Public • Published

diet-ejs

dietjs support for ejs template engine

For more informations about dietjs framework: diet.js

For more informations about the ejs template engine : http://ejs.co/

instalation

npm install --save diet-ejs

example

index.js

 
var app=require('diet')();
var ejs=require('diet-ejs')();
 
 
app.header(ejs);
 
app.get('/',function($){
        $.data.message='John';
        $.render('index');   
});
 
app.listen('http://localhost:7500');
 
 

index.ejs

<p> Hello <%=message%> </p>

customisation

By default the middleware comes with some default settings that you can customize using the options in the module constructor.

var ejs=require('diet-ejs')({
        template_dir: './views',   //by default the location of the templates is in the views folder 
        template_ext: 'ejs',       //the default extension of the template files is .ejs
        debug:false,               //no debug info
        cache:false                //no caching
});

Install

npm i diet-ejs

DownloadsWeekly Downloads

1

Version

1.0.0

License

MIT

Last publish

Collaborators

  • avatar