使用 Symfony 2 的带有 CDN 的 Twig 资产 [英] Twig asset with CDN using Symfony 2
本文介绍了使用 Symfony 2 的带有 CDN 的 Twig 资产的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
出于性能原因,我想从 CDN 交付我的一些文件.
For performance reasons, I want to deliver some of my files from a CDN.
是否可以配置资产"助手,使其自动设置诸如static1.xxxx.com/css/main.css"和static2.xxxx.com/css/main.css"之类的内容?
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"?
也许是这样的:
{{ asset('css/main.css',static1) }}
推荐答案
在 config.yml 中添加如下内容:
in in config.yml just add something like:
framework:
templating:
engines: ['twig']
assets_base_urls:
http: [http://yourcdn.com]
这篇关于使用 Symfony 2 的带有 CDN 的 Twig 资产的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文