I can't figure out how to use EJS templates with the framework sails.js.
Here is what I've tried:
ejs = require('ejs')
new ejs({url: 'assets/linker/templates/box.ejs'}).render(data);
But I get object is not a function
Any example? I tried to follow the example here: .html
But I don't understand why they ask to download the script ejs_production.js
...
I can't figure out how to use EJS templates with the framework sails.js.
Here is what I've tried:
ejs = require('ejs')
new ejs({url: 'assets/linker/templates/box.ejs'}).render(data);
But I get object is not a function
Any example? I tried to follow the example here: http://embeddedjs./getting_started.html
But I don't understand why they ask to download the script ejs_production.js
...
- ejs is the default templating in engine in sails.js. You don't need to do any thing to start working with it. – Mahammad Adil Azeem Commented Jul 18, 2014 at 5:13
- I have found how to use client side templates, but I still don't understand how tu use them from the server side. – Vadorequest Commented Jul 18, 2014 at 6:05
- I can't understand your point of using them on server side.. – Mahammad Adil Azeem Commented Jul 18, 2014 at 7:29
- Because I want to use a template inside another template and I prefer doing so in the server side instead. – Vadorequest Commented Jul 18, 2014 at 8:01
1 Answer
Reset to default 6assets/templates is used for JST
and,
Example is used client side
server side include ? https://github./visionmedia/ejs#includes
views/header.ejs
<header>
<h1>title: <%- title %> </h1>
</header>
views/layout.ejs
<body>
<% include header %>
...
extends? (Japanese) ※ roundabout
http://nantokaworks./node-advent2013-day20/
Both of Server Side and Client Side ?
sorry. no idea about it...
assets/mon/header.ejs
<header>
<h1>title: <%- title %> </h1>
</header>
views/layout.ejs
<body>
<% include ../assets/mon/header %>
It may be used in both in this way...
new ejs({url: 'assets/mon/header.ejs'}).render(data);
or grunt-contrib-copy, folder views/mon to assets/mon