Skip to content

sidorares/pugify

master
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
 
 
 
 
 
 
 
 
 
 
 
 

pugify

pug transform for browserify v2. Sourcemaps generation included.

screen shot 2013-08-28 at 5 02 16 pm

Bitdeli Badge

Configuration

Format

    var b = browserify();
    # these options are passed directly to pug compiler
    var pugConfig = {
        pretty: true,
        compileDebug: false
    };
    # if babelConfig is defined, the output will be transpiled using babel, and the options are passed into babel transpiler
    # this is useful when you need to support old browsers, since pug compiles into ES6 format.
    var babelConfig = {
        presets: ['es2015']
    };
    b.transform(require('pugify').pug(pugConfig, babelConfig));

If you are using pugify programatically, you can pass options to the Pug compiler by calling pug() on the pugify transform:

    var b = browserify();
    b.transform(require('pugify').pug({
        pretty: true
    }));

If you are using pugify in a command line build, you can pass parameters by adding a "pugify" section to your package.json. You can either include parameters directly:

    "pugify": {
        "pretty": true
    }

or for more complicated cases you can reference a .js file:

    "pugify": "./assets/pugify-config.js"

And then in pugify-config.js:

    module.exports = {
        pretty: (process.env.NODE_ENV == 'production') ? false : true
    };

To disable sourcemap generation, which results in smaller compiled files for production builds, set pug option compileDebug to false in the options:

    var b = browserify();
    b.transform(require('pugify').pug({
        compileDebug: false
    }));

or in package.json:

     "pugify": {
        "compileDebug": false
    }

About

jade transform for browserify v2. Sourcemaps generation included.

Resources

License

Stars

Watchers

Forks

Packages

No packages published