jade-globals
Detect which global variables are needed for your jade templates
Last updated 5 years ago by pgilad .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install jade-globals 
SYNC missed versions from official npm registry.

jade-globals Build Status

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

Current Tags

  • 1.1.0                                ...           latest (5 years ago)

1 Versions

  • 1.1.0                                ...           5 years ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 1
Dependencies (7)
Dev Dependencies (2)
Dependents (0)
None

Copyright 2014 - 2016 © taobao.org |