2012-11-12 51 views
2

當使用jQuery UI時,我遇到asset_url問題,因爲Symfony2 Assetic沒有找到圖像。jQuery UI資產管理asset_url

{% macro css(file) %} 
<link rel="stylesheet" href="{{ file }}" type="text/css" /> 
{% endmacro %} 

{% stylesheets 
    '@ClientResultBundle/Resources/public/css/ui-lightness/jquery-ui-1.9.1.custom.min.css' 
    filter='cssrewrite' 
%} 

{{ imp.css(asset('bundles/clientresult/css/ui-lightness/jquery-ui-1.9.1.custom.min.css')) }} 

當我使用asset只是,它似乎工作,爲什麼不與asset_url是更優雅,我認爲(因爲我們可以一次傳遞一些資源)。

<link rel="stylesheet" href="{{ asset(file) }}" type="text/css" /> 

在此先感謝。

回答

2

您的資產鏈接必須是內部的樣式表框

{% stylesheets filter='cssrewrite' 
    '@ClientResultBundle/Resources/public/css/ui-lightness/jquery-ui-1.9.1.custom.min.css' 
%} 
    <link href="{{ asset_url }}" type="text/css" rel="stylesheet" media="screen" /> 
{% endstylesheets %} 
+0

更多信息,請閱讀[該文檔(http://symfony.com/doc/current/cookbook/assetic/asset_management.html) –

+0

好的,謝謝,對於延遲抱歉,在我看來,我已經做了所有必要的事情,以通過郵件接收回復通知,但我沒有收到它們:/ – mysthiq

+0

只有一件事,我想用'jquery-ui -1.9.1.custom.min.css',而不是'@ ClientResultBundle/Resources/public/css/ui-lightness/jquery-ui-1.9.1.custom.min.css',因爲總是放不下路徑。宏似乎不工作,所以我如何指定一個路徑? – mysthiq