Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
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 30,727 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.
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.