Repository navigation
Building Symphony's Assets
Symphony uses gruntjs as its frontend build system. Every time you make a change in any css or javascript file, you must run the grunt tasks in order to test your code, since Symphony always load the minified versions.
In order to get up and running with Grunt, you must install nodejs. Be sure to also install npm when installing nodejs.
Once nodejs is installed and available in your PATH, you can install the grunt cli as follow:
npm install grunt-cli -g
This step only needs to be run once on your machine since it will install grunt-cli globally (that's why there is the -g flag)
In the root directory of the project, you should find a package.json file. This file contains the dependencies we need in order to run the gruntfile.js file. To install these dependencies run:
npm i
This will download all the needed code in the node_modules folder (which git should already ignore). This step also only needs to be run once on your machine. You might also want to run in periodically in order to update the dependencies if the core team changes it.
Building is really simple. One single word.
grunt
That's it. For those who know make, grunt follows the same principles. You can run a single task by calling grunt taskname. Available tasks are:
-
default: runs all tasks. this is the task that is run when no task is specified. -
css: runs all css related tasks. -
js: runs all javascript related tasks. -
watch: enables auto-running the tasks when a file is changed. Ideal for coding.