Skip to content

Does Simplifyify have a programmatic API (for use in Gulp, Grunt, etc.)? #3

Closed
@JamesMessinger

Description

@JamesMessinger

This question was asked by @nmccready on another issue. I'm answering it here so it's easy for other people to find as well.

The answer is, "Yes!". Simplifyify does have a programmatic API. You aren't limited to using its command-line interface. In fact, the CLI is simply a very thin wrapper around the programmatic API. Here's the API, and here's sample code. Basically, you just pass an array of strings (file paths and/or glob patterns) and an options param. You get back an EventEmitter, which fires all the Browserify & Watchify events.

var simplifyify = require("simplifyify");

gulp.task("browserify", function(done) {
  simplifyify("lib/*.module.js", 
    { 
        outfile: "dist/*.bundle.js", 
        debug: true,
        minify: true 
    })
    .on("end", function() {
        // Finished successfully!
        done();
    })
    .on("error", function(err) {
        // Something went wrong
        done(err);
    });
});

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions