【问题标题】:Symfony2 themingSymfony2 主题
【发布时间】:2011-08-15 10:25:05
【问题描述】:

我想在我的 Symfony2 项目中支持基本的主题,所以我想为每个主题分离静态文件(css、js、img)。

我已经尝试添加

assetic:
    read_from:  %kernel.root_dir%/../web/themes/mytheme

但这没有效果,我的 {{asset('css/style.css') }} 仍然将 realtic 引用到 %kernel.root_dir%/../web,而不是 %kernel.root_dir%/../网页/主题/mytheme。

有什么想法吗?

【问题讨论】:

    标签: themes symfony assets


    【解决方案1】:

    用配置修复:

    assetic:
        debug:          %kernel.debug%
        use_controller: false
        read_from: %kernel.root_dir%/../web/bundles/mybundle/themes/%my_theme%
        write_to: %kernel.root_dir%/../web
        filters:
            yui_css:
                jar: "%kernel.root_dir%/Resources/java/yuicompressor.jar"
            yui_js:
                jar: "%kernel.root_dir%/Resources/java/yuicompressor.jar"
    

    在布局中我有:

        {% stylesheets 'css/*' filter='?yui_css' %}
        <link rel="stylesheet" type="text/css" media="all" href="{{ asset_url }}" />
        {% endstylesheets %}
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-03-17
      • 1970-01-01
      • 1970-01-01
      • 2014-04-13
      • 1970-01-01
      相关资源
      最近更新 更多