symfony-grunt-edition
symfony-grunt-edition copied to clipboard
The "Symfony Grunt Edition" distribution
trafficstars
Symfony Grunt Edition
This is a Symfony Edition that replaces Assetic with a grunt configuration. I have some taken some liberties based on my development style. When doing frontend development, I don't like waiting for some kind of watch task. I like my updates to be instant. This edition allows for your frontend assets to be linked to the source in development and linked to the minified version in production.
Requirements
- npm
- bower (
sudo npm install -g bower) - grunt (
sudo npm install -g grunt-cli)
Installation
> composer install
> bower install
> npm install
> grunt
Grunt Tasks
clean: removesweb/_staticcontentsjshint: detect errors in your javasciptuglify: minify your javasciptcssmin: minify your cssmodernizr: install/configure modernizr based on your javascript files\- (default): runs all the above
Configuration
To configure the assets for you project, add them to app/config/assets.json. Both Symfony2 and grunt use
this configuration.
Summary of changes from the Symfony Standard Edition
New Files
bower.json: bower package configuration.bowerrc: bower configuration to install frontend assets toweb/vendorpackage.json: npm package configuration (for grunt)app/config/assets.json: global asset configurationapp/config/config.php: sets a Symfony2 parameter based on the aboveassets.jsonconfigurationgruntfile.js: configures grunt, assets for minification are pulled from the aboveassets.jsonweb/css/main.css/web/js/script.js: test assets
Modified Files
app/config/config.yml: added twig global variableapp_assetswhich is set to the parameter set inconfig.phpapp/Resources/views/base.html.twig: modified thestylesheetsandjavascriptsblock to load these assets based on the aboveapp_assetsconfiguration (app.debug=true: source is used,app.debug=false: min is used)
Other Changes
- Removed Assetic
- Simplifed DemoBundle
- Removed
bootstrap.php.cache- use composer's--optimize-autoloaderoption