Security News
RubyGems.org Adds New Maintainer Role
RubyGems.org has added a new "maintainer" role that allows for publishing new versions of gems. This new permission type is aimed at improving security for gem owners and the service overall.
grunt-contrib-jade
Advanced tools
Compile Jade templates.
This plugin requires Grunt ~0.4.1
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-contrib-jade --save-dev
Once the plugin has been installed, it may be enabled inside your Gruntfile with this line of JavaScript:
grunt.loadNpmTasks('grunt-contrib-jade');
This plugin was designed to work with Grunt 0.4.x. If you're still using grunt v0.3.x it's strongly recommended that you upgrade, but in case you can't please use v0.3.1.
Run this task with the grunt jade
command.
Task targets, files and options may be specified according to the grunt Configuring tasks guide.
Type: Boolean
Default: false
Output indented HTML.
Type: Object
Sets the data passed to Jade during template compilation. Any data can be passed to the template (including grunt templates).
This value also might be a function taking source and destination path as arguments and returning a data object. Within the function, this
is bound to the file configuration object.
options: {
data: function(dest, src) {
return {
from: src,
to: dest
};
}
}
or you can have options from a required JSON file:
options: {
data: function(dest, src) {
// Return an object of data to pass to templates
return require('./locals.json');
}
}
Type: Object
If you want to use filters you have two ways to do it. First you can write your filters inline within your Gruntfile.js or define filters in separate file and export it.
Filters are given a context with the jade
instance and local variables: {jade: jade, data: data}
, where jade
is global jade instance and data
is options passed to options.data
. You can use this.jade.render()
inside your filters to render the content of a block and locals as #{variable}
from your data.
Gruntfile.js:
options: {
filters: {
some: function(block) {},
another: function(block) {}
}
}
Gruntfile.js:
options: {
filters: require('./filters.js')
}
filters.js:
var jadefilters = module.exports = {};
jadefilters.some = function(block) {};
jadefilters.another = function(block) {};
Type: Boolean
Default: true
Add Jade debug instructions to generated JS templates.
Type: Boolean
Default: false
Compile to JS template functions for client-side use rather than directly to HTML.
Make sure to also include the Jade runtime (only runtime.js
) as described in the Jade documentation.
Type: String
, Boolean
Default: JST
The namespace in which the precompiled templates will be assigned. Use dot notation (e.g. App.Templates
) for nested namespaces or false
for no namespace wrapping.
When set to false
with amd option set to true
, the templates will be returned directly from the AMD wrapper.
Type: Boolean
Default: false
Wraps the output file with an AMD define function and returns the compiled template namespace unless namespace has been explicitly set to false in which case the template function will be returned directly.
define(function() {
//...//
returns this['[template namespace]'];
});
Type: Function
This option accepts a function which takes one argument (the template filepath) and returns a string which will be used as the key for the precompiled template object.
Example Store all template on the default JST namespace in capital letters.
options: {
processName: function(filename) {
return filename.toUpperCase();
}
}
Type: Function
Default: function(content) { return content; };
This option accepts a function that lets you perform additional content processing.
jade: {
compile: {
options: {
data: {
debug: false
}
},
files: {
"path/to/dest.html": ["path/to/templates/*.jade", "another/path/tmpl.jade"]
}
}
}
If you want to generate a debug file and a release file from the same template:
jade: {
debug: {
options: {
data: {
debug: true
}
},
files: {
"debug.html": "test.jade"
}
},
release: {
options: {
data: {
debug: false
}
},
files: {
"release.html": "test.jade"
}
}
}
If you want to use grunt
template in options.data
:
jade: {
debug: {
options: {
data: {
debug: true,
timestamp: "<%= new Date().getTime() %>"
}
},
files: {
"debug.html": "test.jade"
}
}
}
or you can use grunt
helpers (grunt object was exposed at template context):
jade: {
debug: {
options: {
data: {
debug: true,
timestamp: "<%= grunt.template.today() %>"
}
},
files: {
"debug.html": "test.jade"
}
}
}
Task submitted by Eric Woroshow
This file was generated on Sun Mar 02 2014 15:12:20.
FAQs
Compile Jade templates
The npm package grunt-contrib-jade receives a total of 819 weekly downloads. As such, grunt-contrib-jade popularity was classified as not popular.
We found that grunt-contrib-jade demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 6 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
RubyGems.org has added a new "maintainer" role that allows for publishing new versions of gems. This new permission type is aimed at improving security for gem owners and the service overall.
Security News
Node.js will be enforcing stricter semver-major PR policies a month before major releases to enhance stability and ensure reliable release candidates.
Security News
Research
Socket's threat research team has detected five malicious npm packages targeting Roblox developers, deploying malware to steal credentials and personal data.