Security News
Weekly Downloads Now Available in npm Package Search Results
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.
templates
Advanced tools
Templates is a jade template prepackager for Express, inspired by Jammit Templates is written in coffeescript by Marcel Miranda.
npm install templates
Considering your project directory structure is like the following:
app.js
views/
templates/
notification/
panel.jade
profile.jade
var templates = require 'templates'
// Create express app
var app = express.createServer()
app.use(templates({
// src is the directory where jade template files are stored
src: __dirname + "/templates",
// url is the url the request will respond to
url: "/templates.js",
// namespace is the javascript object the
// templates will be attached to
namespace: "window.templates"
}))
<!-- Add templates script to page -->
<script src="/templates.js"></script>
<!-- Use templates -->
<script>
templates.profile({name: "John", age: 25})
// Will return a html string based on templates/profile.jade
templates.notification.panel({title: "Error", message: "Could not log in"})
// Will return a html string based on templates/notification/panel.jade
</script>
Templates will look for the process.env.NODE_ENV to see if working on production environment. When running on production, Templates will automatically compress the templates file using uglify-js. When not running on production, Templates will leave jade's compileDebug option to true, which leaves line numbers for debugging purposes.
Copyright © 2012 Marcel Miranda. See LICENSE for further details.
FAQs
System for creating and managing template collections, and rendering templates with any node.js template engine. Can be used as the basis for creating a static site generator or blog framework.
The npm package templates receives a total of 27,787 weekly downloads. As such, templates popularity was classified as popular.
We found that templates demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 3 open source maintainers 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
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.
Security News
A Stanford study reveals 9.5% of engineers contribute almost nothing, costing tech $90B annually, with remote work fueling the rise of "ghost engineers."
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.