Symfony2编译资产YUI

时间:2013-04-21 01:04:29

标签: symfony capistrano yui assetic compiled

我创建了一个名为'staging'的新环境,它与'production'环境几乎完全相同,我正在尝试在我的css和js文件上使用yui_compressor。请参阅下面的css文件示例:

{% stylesheets output='css/compiled/main.css' filter='?yui_css' filter='cssrewrite'
    'bundles/xyz/lib/frontend/css/social_foundicons.css'
    'bundles/xyz/lib/frontend/css/general_enclosed_foundicons.css'
    'bundles/xyz/lib/frontend/css/general_foundicons.css'
    'bundles/xyz/lib/frontend/coda/css/coda-slider.css'
    %}
    <link rel="stylesheet" type="text/css" media="screen" href="{{ asset_url }}" />
    {% endstylesheets %}

    <!-- Google fonts -->
    {% stylesheets output='css/compiled/fonts.css' filter='?yui_css' filter='cssrewrite'
    'bundles/xyz/lib/frontend/css/fonts.css'
    %}
    <link rel="stylesheet" type="text/css" media="screen" href="{{ asset_url }}" />
    {% endstylesheets %}

    <!-- Included CSS Files -->
    {% stylesheets output='css/compiled/style.css' filter='?yui_css' filter='cssrewrite'
    'bundles/xyz/lib/frontend/css/style.css'
    %}
    <link rel="stylesheet" type="text/css" media="screen" href="{{ asset_url }}" />
    {% endstylesheets %}

使用capistrano进行部署时,会创建以下文件:

  • /web/css/compiled/fonts.css
  • /web/css/compiled/main.css
  • /web/css/compiled/style.css

我认为这是正确的,但我的应用程序中的标题呈现如下:

<link rel="stylesheet" type="text/css" media="screen" href="/css/compiled/main_social_foundicons_1.css" />
<link rel="stylesheet" type="text/css" media="screen" href="/css/compiled/main_general_enclosed_foundicons_2.css" />
<link rel="stylesheet" type="text/css" media="screen" href="/css/compiled/main_general_foundicons_3.css" />
<link rel="stylesheet" type="text/css" media="screen" href="/css/compiled/main_coda-slider_4.css" />

<link rel="stylesheet" type="text/css" media="screen" href="/css/compiled/fonts_fonts_1.css" />

<link rel="stylesheet" type="text/css" media="screen" href="/css/compiled/style_style_1.css" />

服务器上不存在上述文件,我认为应该调用/css/compiled/fonts.css,main.css和style.css。

任何人都知道为什么会这样做?

由于

1 个答案:

答案 0 :(得分:0)

问题是我将暂存环境的调试模式设置为true。