I'd like to globally configure the output dir of where assetic dumps my JS files. Currently, they always go to web/js/*
. I want to change this to web/js/compiled/*
.
It's possible to specify this at a per-file level: http://symfony.com/doc/2.0/cookbook/assetic/asset_management.html#dumping-asset-files
Can't seem to find a way to set this globally across my Symfony app. Any config parameter I'm missing?
UPDATE
Found an assetic config parameter called write_to
. Setting this in config.yml
causes the command line assetic:dump
to dump files to the new dir, but within twig files the asset_url
var still points to the original path.
You should use the property write_to.
in my configuration for exemple I use
# Assetic Configuration
assetic:
debug: %kernel.debug%
use_controller: %kernel.debug%
read_from: %kernel.root_dir%/Resources/views/
write_to: %kernel.root_dir%/../web/static/
Your ouput string start where ends write_to
for exemple
{% javascripts filter="closure" output='js/main.js'
...
{% stylesheets filter='compass,?cssrewrite'
'default/static/sass/screen.scss'
output='css/screen.css'
%}
both will placed respectively in /web/static/js/main.js and /web/static/css/screen.css
assets_base_urls is used to specify base URL's to be used for assets referenced from http and ssl (https) pages.
!! assets_base_urls
is also used by {% images %}
as the root before output
value, but {% images %}
doesn't consider write_to
when rendering html (only when dumping) so better not using write_to
and rely only on output
value. More about it in my other post on stackoverflow and in this post on AsseticBundle's github.