Closed
Description
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);
});
});