
Research
/Security News
Critical Vulnerability in NestJS Devtools: Localhost RCE via Sandbox Escape
A flawed sandbox in @nestjs/devtools-integration lets attackers run code on your machine via CSRF, leading to full Remote Code Execution (RCE).
grunt-dustjs
Advanced tools
Grunt task to compile Dust.js templates.
Install this grunt plugin next to your project's grunt.js gruntfile with: npm install grunt-dustjs
.
Then add this line to your project's grunt.js
gruntfile:
grunt.loadNpmTasks('grunt-dustjs');
Inside your grunt.js
file, add a section named dustjs
with one or more targets. Each section contains a files object that specifies the Dust.js template files to compile.
files
objectThis defines what files this task will process. It can contain any valid Grunt files format.
When using a src/dest format, the key (destination) should be an unique filepath (supports grunt.template) and the value (source) should be a filepath or an array of filepaths (supports minimatch). All source files will be combined into the destination output.
When using the dynamic format (example #3), each source file will be processed into its own destination file.
fullname
default: false
Used to customize the template variable names. If fullname
is true
, the full path will be used as the template name. If fullname
is a function, the function receives a single argument, which is the full path, and returns the name of the template.
transformQuote
default: false
Used to reverse quotes usage by dustjs: double quotes replaced by single quotes and vice versa. Output is more clean after this transformation.
prepend
default: null
Add a custom string to the start of the output file. This is useful for creating custom AMD wrappers, eg: define(['dust'], function(dust){\n
append
default: null
Add a custom string to the end of the output file.
whitespace
default: false
Preserve whitespace.
amd
default: false
Compile as AMD modules.
cjs
default: false
Compile as CommonJS modules.
silent
default: false
Suppress success compile messages.
module.exports = function (grunt) {
//...
grunt.loadNpmTasks('grunt-dustjs');
//...
var config = {
//...
dustjs: {},
//...
};
config.dustjs: {
compile: {
files: {
'js/templates.js': ['src/templates/**/*.html']
}
}
},
});
var path = require('path');
module.exports = function (grunt) {
//...
grunt.loadNpmTasks('grunt-dustjs');
//...
var config = {
//...
dustjs: {},
//...
};
config.dustjs: {
compile: {
files: {
'js/templates.js': ['src/templates/**/*.html']
},
options: {
fullname: function(filepath) {
var key = path.relative('src/templates', path.dirname(filepath)).split(path.sep) // folder names
.concat([path.basename(filepath, path.extname(filepath))]) // template name
.join('.');
if (key.charAt(0) == '.')
return key.substr(1, key.length - 1);
return key;
}
}
}
},
});
module.exports = function (grunt) {
//...
grunt.loadNpmTasks('grunt-dustjs');
//...
var config = {
//...
dustjs: {},
//...
};
config.dustjs: {
compile: {
files: [
{
expand: true,
cwd: 'dust/',
src: '**/*.html',
dest: '',
ext: '.js'
}
]
}
}
});
In lieu of a formal styleguide, take care to maintain the existing coding style. Add unit tests for any new or changed functionality. Lint and test your code using grunt.
Copyright (c) 2013-2016 Stanislav Lesnikov Licensed under the MIT license.
FAQs
Grunt task to compile Dust.js templates.
The npm package grunt-dustjs receives a total of 468 weekly downloads. As such, grunt-dustjs popularity was classified as not popular.
We found that grunt-dustjs 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
A flawed sandbox in @nestjs/devtools-integration lets attackers run code on your machine via CSRF, leading to full Remote Code Execution (RCE).
Product
Customize license detection with Socket’s new license overlays: gain control, reduce noise, and handle edge cases with precision.
Product
Socket now supports Rust and Cargo, offering package search for all users and experimental SBOM generation for enterprise projects.