Adding Npm to a PHP Travis Project

Like most PHP developers, I'm polyglot. My PHP project builds with phing, but uses a bunch of npm tools along the way to minify assets and those types of things. When I introduced TravisCI into my project, I was instantly confused by the requirement to specify the technology I was using ... all of them, surely?

In need of wisdom and advice, I turned to the best source I know:

The answer came back from @Ocramius (thankyou!) who linked to a .travis.yml showing how to use the stock nodejs' npm to add tools in the before_script segment, like this:

- npm install -g grunt-cli
- npm install

Then I can just include a grunt call in my script: section, and all is well. I had a hard time finding this so I thought I'd put it here for next time I need it (and anyone else who might find it handy).

Leave a Reply

Please use [code] and [/code] around any source code you wish to share.

This site uses Akismet to reduce spam. Learn how your comment data is processed.