jade-globals
v1.1.0
Published
Detect which global variables are needed for your jade templates
Downloads
383
Maintainers
Readme
jade-globals
Detect which global variables are needed for your jade templates
Given:
.some-class(title=externalTitle)
table#crazy-table(class=externalClass)
if showHeader
thead
Using jade-globals
will output:
['externalTitle', 'externalClass', 'showHeader']
It's a tool meant to map your required dependencies in your jade files.
Install
# install as a dev dependency
$ npm install --save-dev jade-globals
# install globally for use as cli
$ npm install --global jade-globals
Usage
var fs = require('fs');
var jadeGlobals = require('jade-globals');
var contents = fs.readFileSync('crazy-template.jade', 'utf8');
console.log(jadeGlobals(contents));
// => ['global1', 'global2']
Usage as a cli:
❯ jade-globals --help
Usage: jade-globals [options] <file>
Detect which global variables are needed for your jade templates
Options:
-h, --help output usage information
-V, --version output the version number
-s, --show-jade-global Show the jade global as well
-i, --ignore <keywords> Ignore keyword (default: [])
Examples:
$ jade-globals template.jade
$ jade-globals --ignore someGlobal template.jade
$ cat template.jade | jade-globals
Options
jadeGlobals(contents, params)
contents
String
the contents of the jade file to parse.
Required
params
Object
optional params and their defaults:
{
// the `jade` global is hidden by default. Set to true to include it.
showJadeGlobal: false
// optional ignore list
ignore: []
}
License
MIT © Gilad Peleg