Security News
Fluent Assertions Faces Backlash After Abandoning Open Source Licensing
Fluent Assertions is facing backlash after dropping the Apache license for a commercial model, leaving users blindsided and questioning contributor rights.
JSP-Like (JSPL) is a simple template engine based on the library: underscore. It's compliant with Express. And the syntax is similar to JSP.
JSP Like Template Engine for ExpressJS and NodeJS (based on underscore, support include, cache...)
see: Example section
$npm install jspl -save
// Edit app.js, let's JSPL bind to the express app.
var app = express();
// Disable jade by removing or commenting
// app.set('view engine', 'jade');
// view engine setup
app.set('views', path.join(__dirname, 'views'));
// Disable cache for debug. or set to true: to enable cache in production.
app.set('view cache', false);
// Bind JSPL to express.
var jspl = require('jspl');
jspl.bind(app);
// Default extension is .html
jspl.setExtension('.jspl');
An example of application is available under: sample/express/ it shows the template engine in action with express.
File: views/index.html
<% if(user){ %>
<%= user.profile.firstName %></p>
<% } %>
File: app.js
router.get('/', function(req, res)
{
res.render('index', {user: {profile: {firstName: 'Mike'} } });
});
File: views/index.html
<h1>Hello <%= name %></h1>
File: app.js
app.get('/', function(req, res)
{
res.render('index', {name: 'John'});
})
Result:
<h1>Hello John</h1>
File: views/index.html
<h1>Hello</h1>
<ol>
<% _.each(people, function(name) { %>
<li><%= name %></li>
<% }); %>
</ol>
File: app.js
app.get('/', function(req, res)
{
res.render('index', {people: ['moe', 'curly', 'larry']});
})
Result:
<h1>Hello</h1>
<ol>
<li>moe</li>
<li>curly</li>
<li>larry</li>
</ol>
<%@ template file="templateName" %>
For example: view.html
<%@ template file="layout" %>
layout.html must include the place where the view is inserted.
<jspl:doLayout>
@see: sample/express
<%@ include file="viewName" %>
This template engine build is animate by a complete regression test suite.
The simple template language is very close to JSP. It's based on underscore.
This project does not provide any advanced JSP tag. underscore. Compliant with Express. Add the tag include for HTML fragment.
I do not like Jade or whatever short HTML template engine. I understand why it's a good solution for basic website. But it does not mix well with complex HTML + Javascript Framework like AngularJS. Also, I think software developer should generally minimize the number of transformation that must be done to produce an output.
FAQs
JSP-Like (JSPL) is a simple template engine based on the library: underscore. It's compliant with Express. And the syntax is similar to JSP.
We found that jspl demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Fluent Assertions is facing backlash after dropping the Apache license for a commercial model, leaving users blindsided and questioning contributor rights.
Research
Security News
Socket researchers uncover the risks of a malicious Python package targeting Discord developers.
Security News
The UK is proposing a bold ban on ransomware payments by public entities to disrupt cybercrime, protect critical services, and lead global cybersecurity efforts.