Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Twig asset with CDN using Symfony 2

Tags:

twig

symfony

For performance reasons, I want to deliver some of my files from a CDN.

Is it possible to configure the "asset" helper such that it automaticly sets something like "static1.xxxx.com/css/main.css" and "static2.xxxx.com/css/main.css"?

Perhaps something like:

{{ asset('css/main.css',static1) }}
like image 575
René Höhle Avatar asked Sep 09 '11 07:09

René Höhle


1 Answers

in in config.yml just add something like:

framework:
    templating:
      engines: ['twig']
      assets_base_urls:
        http: [http://yourcdn.com]
like image 92
Nuno Costa Avatar answered Nov 11 '22 05:11

Nuno Costa