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.
grunt-contrib-hogan
Advanced tools
Hogan template compiler task for grunt.
Install this grunt plugin next to your project's grunt.js gruntfile with: npm install grunt-contrib-hogan
Then add this line to your project's grunt.js
gruntfile:
grunt.loadNpmTasks('grunt-contrib-hogan');
Grunt task that compiles Hogan templates into functions that can be loaded into the browser as is, or minified prior to loading.
Configuration for this task is added to your grunt.js
file with the hogan
key.
object
destination: [source]
object
string
The namespace that the templates will be assigned to, the default is Templates
.
Example:
options: {
namespace: 'T'
}
boolean
Wraps the compiled templates with the require.js define(function() {})
function.
Example:
options: {
amdWrapper: true
}
Produces:
define(function() {
this["Templates"] = this["Templates"] || {};
return this["Templates"];
});
object
Wraps the compiled templates with the require.js define(function() {})
function.
Example:
options: {
amdWrapper: true,
amdRequire: {
hogan: "Hogan",
otherLibrary: "$"
}
}
Produces:
define(["hogan","otherLibrary"], function(Hogan, $) {
this["Templates"] = this["Templates"] || {};
return this["Templates"];
});
boolean
Wraps the compiled templates in a CommonJS module.exports
for use with component(1).
Example:
options: {
commonJsWrapper: true
}
Produces:
this["Templates"] = this["Templates"] || {};
if (typeof module !== 'undefined' && typeof module.exports !== 'undefined') {
module.exports = this["Templates"];
}
// with "component build" this will be wrapped in:
// require.register("project/file", function(exports, require, module){
// ...
// });
boolean
Strip out spaces from the compiled templates, and make the output look a little better by indenting template definitions.
function
args:
filename
Function that returns the key that the template file will be assigned.
Example:
options: {
defaultName: function(filename) {
return filename.split('/').pop();
}
}
object
Any options that might need to be passed to the Hogan.compile()
function.
hogan: {
publish: {
options: {
prettify: true,
defaultName: function(file) {
return file.toUpperCase();
}
},
files:{
"path/to/compiled.js": ["path/to/source/**/*.html"]
}
}
}
Copyright (c) 2012 Matt McFarland Licensed under the MIT license.
FAQs
Hogan template compiler task for grunt.
The npm package grunt-contrib-hogan receives a total of 1 weekly downloads. As such, grunt-contrib-hogan popularity was classified as not popular.
We found that grunt-contrib-hogan 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.
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.