Symfony2 Snippets

Snippets and useful notes as I work with Symfony2 and learn the conventions.

Clear the cache:

app/console cache:clear

If you do not flag this command for the environment it will run the command only for the dev environment (not what we want when testing CSS compression or JS minification). To clear cache for production:

app/console cache:clear --env prod

Update assets served by assetic (from your /src/... dir). Unless you have a symlink, this has to be run every time you update your CSS or JS.

app/console assets:install web

To add the symlink:

app/console assets:install --symlink web

Another user mentions that symlinks will be obliterated when bundles are updated. :(

After installing your assets, you have to "dump" them to /web. And you have to flag the environment when you do so:

// For production environment
app/console assetic:dump --env prod 
// For development environment
app/console assetic:dump --env dev

The full set I run before checking something on production:

app/console cache:clear --env prod
app/console assets:install web
app/console assetic:dump --env prod

 

 

comments powered by Disqus