Symfony 2 - Access public asset directly -


i have folder called "cdn" in /web folder , give public access javascript file in there (basically, it's bookmarklet). don't want use controller serve file rather let server serve file directly.

how in symfony 2 ? (ps i' using assetic)

thanks in advance, romain

you can use different directory defining root of public folder using assets_base_urls in configuration:

app/config/config.yml:

templating:     assets_base_urls: "%assets_base_urls%" 

this use value defined in specific contexts:

app/config/config_dev.yml:

parameters:     assets_base_urls: "http://localhost/.../cdn/" 

app/config/config_prod.yml:

parameters:     assets_base_urls: "http://cdn.example.com/" 

this url should points directory on server, e.g. /var/www/site/public/.

you'll have dump assets corresponding directories in both contexts in order put files right directory:

# dev php app/console assetic:dump --env=dev .../cdn --no-debug # prod php app/console assetic:dump --env=prod `/var/www/site/public/` --no-debug 

Comments

Popular posts from this blog

php - failed to open stream: HTTP request failed! HTTP/1.0 400 Bad Request -

java - How to filter a backspace keyboard input -

java - Show Soft Keyboard when EditText Appears -