CDN在Symfony twig中使用资产回落

时间:2016-12-21 08:55:22

标签: symfony twig cdn assetic

我有Bootstrap的本地副本,我使用assetic与其他库一起缩小但是阅读此 solution,我想使用CDN加载Bootstrap,如果CDN已关闭,则返回Bootstrap的本地副本(与其他当地图书馆缩小)。如何使用Assetic在Twig中实现这一目标?目前的代码:

<!DOCTYPE html>
<html>
    <head>
        <meta charset="UTF-8" />
        <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0">
        <title>{% block title %}Welcome!{% endblock %}</title>

        {% block stylesheets %}
            {% stylesheets filter="cssrewrite, scssphp" output="css/app.css"
                "assets/vendor/bootstrap/dist/css/bootstrap.min.css"
                "assets/vendor/components-font-awesome/css/font-awesome.min.css"
                "assets/vendor/bootstrap-material-design/dist/css/bootstrap-material-design.css"
                "assets/custom-assets/scss/background.scss"
             %}
                <link rel="stylesheet" href="{{ asset_url }}" />
            {% endstylesheets %}
        {% endblock %}

    </head>
    <body>
     ....
    </body>
    </html>

0 个答案:

没有答案