Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
JamesMessinger opened this issue Sep 15, 2015 · 7 comments
Labels

Comments

@JamesMessinger
Copy link
Member

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);
    });
});
@JamesMessinger
Copy link
Member Author

I'm leaving this issue open until I get around to documenting the API in the README

@nmccready
Copy link

ty

@JamesMessinger
Copy link
Member Author

👍 sure thing. Sorry it took so long to get around to it. The joys of being the sole maintainer of several open-source projects :-/

@nmccready
Copy link

I sure know how that goes; not fun when it is large at scale

@nmccready
Copy link

I'm trying to remember how I got here; this is the workaround sourcemaps to get the raw js to debug unlike browserify right? I

@JamesMessinger
Copy link
Member Author

yeah. it extracts the sourcemaps to external files, so they work better with most debugging tools

@nmccready
Copy link

Cool; yeah I need to do this as I was waiting on your reply; tired of debugging coffee in the browser.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants