
Security News
Deno 2.2 Improves Dependency Management and Expands Node.js Compatibility
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
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 21,621 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
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
Security News
React's CRA deprecation announcement sparked community criticism over framework recommendations, leading to quick updates acknowledging build tools like Vite as valid alternatives.
Security News
Ransomware payment rates hit an all-time low in 2024 as law enforcement crackdowns, stronger defenses, and shifting policies make attacks riskier and less profitable.