Run Gulp tasks during composer install

composer-php, gulp, heroku, laravel, php

Solution

You use the so-called "multi-buildpack" to perform both a Node.js (to install Gulp) and PHP build upon deploy.

Here's an example I built a while ago that uses Bower to install Bootstrap in a Composer `post-install-cmd`, but the principle is going to be the same:

http://heroku-multipack-nodejs-php-ex.herokuapp.com

Sources with `README` that explains the process: https://github.com/dzuelke/heroku-multipack-nodejs-php-example

You can also use the `composer compile` step if you prefer the Gulp install not to run on each `composer install`: https://devcenter.heroku.com/articles/php-support#custom-compile-step

Problem

I'm deploying a PHP app to Heroku using Composer. Currently I'm using Gulp to compress CSS/JS and commit it to the Git repository. I was wondering if it makes more sense to run the Gulp tasks using Composer's `post-install-cmd`. What is the best practice for that?

Original source