JPM and Gulp

Since JPM is a NodeJS tool would it be possible to include it into a Gulp workflow and if so how?

It should definitely be possible to run jpm inside a gulp task by using something like gulp-exec or even a child_process.

What exactly are you trying to achieve?

I want to run jpm after the scss is compiled and some of js files are bundled together. Right now I’m using jpm watchpost in the command line and it runs anytime there’s a change in the directory to update the add-on while I work, but I’d like jpm to update the add-on after the files are processed.

Because right now, when I save the the files watchpost updates the add-on, but it does it before they are processed in my gulp task and the files are processed before it’s done updating the add-on. So watchpost doesn’t update the add-on with the processed files.

There is a grunt module that can do some things (directly using the node modules), but not everything yet. I haven’t personally looked at how accessible the modules are for usage directly within node, but at least jpm run and jpm xpi seem to be possible from within node. See https://www.npmjs.com/package/grunt-jpm for the grunt task.

Hmm. I think since gulp takes care of watch, you should be using jpm post inside a gulp task. That should work.

Also, you should definitely consider using just npm as a build tool if your project is simple.