Precompile assets on Heroku

Everywhere online talks about Rails when it comes to building assets during slug compilation. Is there a way to do this with the other languages like Node.js or PHP?

I have a situation where I need to compile my javascript files with Closure-Compiler and I created a script that calls the compiler and when it's done, it's call node app.js. Then in your Procfile, you need to call you newly created script. Something like web: ./compile_and_start_server.sh

You can also check for the "prestart" in package.json but this I never tried it.

https://npmjs.org/doc/scripts.html