
Research
/Security News
Weaponizing Discord for Command and Control Across npm, PyPI, and RubyGems.org
Socket researchers uncover how threat actors weaponize Discord across the npm, PyPI, and RubyGems ecosystems to exfiltrate sensitive data.
grunt-mustache-generate
Advanced tools
Grunt task to generate html pages and optionally partials for reuse client side.
Grunt task to generate html pages and optionally partials for reuse client side.
This plugin requires Grunt >=0.4.0
If you haven't used Grunt before, be sure to check out the Getting Started guide, as it explains how to create a Gruntfile as well as install and use Grunt plugins. Once you're familiar with that process, you may install this plugin with this command:
npm install grunt-mustache-generate --save-dev
Once the plugin has been installed, it may be enabled inside your Gruntfile with this line of JavaScript:
grunt.loadNpmTasks('grunt-mustache-generate');
There are a number of options available. Please review the minimatch options here. As well as some additional options as follows:
Type: String|Array
This defines what file patterns this task will watch. Can be a string or an array of files and/or minimatch patterns.
Type: String
This defines the location of a JSON file containing settings shared across all mustache pages.
Type: Boolean
Don't compress pages.
Type: Object
This defines the mustache partials if used.
Type: Array
Base directories containing mustache partials (task recursively searches within these directories).
Type: String
If you want to output the partials as a Javascript consumable, set a target filename (without file extension).
Type: String
By setting a variable name, the partial output will be saved as a .js file with the varName equal to the template object. (If you don't set this, the partial output will be a .json file)
Type: Boolean
Don't compress partials.
Type: String
Page data is by default looked for in the same directory as the mustache pages. If desired the json can be contained in a separate directory.
Type: String
If used, the json will be first searched for using the format <page>.<env>.json
If no file exists or no environment is set, fall back to <page>.json
Type: String
Default: .html
Set the page output file extension.
Type: Integer
Default: 1
Set the logging levels: 0 = no logging. 1 = log pages. 2 = (and) log partials.
mustacheGenerate: {
options: {
globalData: 'site.json',
partials: {
src: ['partialDir', 'other_partialDir'],
dest: 'target/partials',
varName: 'myNS.partials'
},
dataDir: 'data',
env: grunt.option('env') || process.env.GRUNT_ENV,
output: '.html',
logLevel: 2
},
files: {
expand: 'true',
cwd: 'pages/',
src: '**/*.mustache',
dest: 'target'
}
}
Each data file can pull in external data for itself and for child data files.
Specify the location of the data in a special base level object called "copy". This object contains a reference to each chunk of data, which itself needs to be valid JSON data, either raw in a json file (you don't need to add a file extension), as the value of a javascript variable, or a jsonp response object.
messages.json
{
"alerts": {
"global": {
"header": "Global Message",
"message": "Global field message"
},
"field": {
"header": "Field Message",
"message": "Field level message"
}
}
}
site.json
{
"copy": {
"messages": "messages"
}
}
pages/index.json
{
"messages": {
"alertInfo": true,
"alertHeader": "`messages.alerts.global.header`",
"alertMessage": "`messages.alerts.global.message`"
}
}
messages.js
NS.messages = {
"alerts": {
"global": {
"header": "Global Message",
"message": "Global field message"
},
"field": {
"header": "Field Message",
"message": "Field level message"
}
}
};
site.json
{
"copy": {
"messages": "messages.js"
}
}
pages/index.json
{
"messages": {
"alertInfo": true,
"alertHeader": "`messages.alerts.global.header`",
"alertMessage": "`messages.alerts.global.message`"
}
}
messages.js
NS.messages({
"alerts": {
"global": {
"header": "Global Message",
"message": "Global field message"
},
"field": {
"header": "Field Message",
"message": "Field level message"
}
}
});
site.json
{
"copy": {
"messages": "messages.js"
}
}
pages/index.json
{
"messages": {
"alertInfo": true,
"alertHeader": "`messages.alerts.global.header`",
"alertMessage": "`messages.alerts.global.message`"
}
}
FAQs
Grunt task to generate html pages and optionally partials for reuse client side.
We found that grunt-mustache-generate 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 researchers uncover how threat actors weaponize Discord across the npm, PyPI, and RubyGems ecosystems to exfiltrate sensitive data.
Security News
Socket now integrates with Bun 1.3’s Security Scanner API to block risky packages at install time and enforce your organization’s policies in local dev and CI.
Research
The Socket Threat Research Team is tracking weekly intrusions into the npm registry that follow a repeatable adversarial playbook used by North Korean state-sponsored actors.