I have been programming for the last two months in Symfony.
I use a tool for asset management, called Assetic. The only thing I was stressed about, was that after I change some files or add new ones (javascript/css/less files), I had to execute a set of commands each time to have all assets generated again:
app/console cache:clear
app/console assetic:dump
app/console assets:install web
My first attemp to automate this, was to build a bash script. It was good, but not perfect. I still had to execute manually a command. I then tried to create a Symfony command that overrided the “app/console assetic:dump –watch”, with no success.
It took me less than an hour to have a script which watched my current Symfony project and automatically executed the commands necessary to generate the static assets.
The package.json file has all the dependencies needed, so you just have to do npm install to install what is needed to execute Gruntfile.js. Keep in mind that the two files (package.json and Gruntfile.js have to be on your project root).
The Gruntfile.js is the file that will be executed each time you do grunt. In this case, to start the watch mode you have just to do grunt watch, and voilá! It will watch the baseURL we have defined. This is just the script I have created to solve my particularly problem. Feel free to change it to fill your needs.
Gruntfile.js
Conclusions
The grunt tool is great! I don’t have to execute the same commands anymore to generate assets. After it detects the change of a file, it will generate all the assets automatically.