资产和过滤器

时间:2013-03-11 10:51:01

标签: symfony filter

我尝试使用cssembed过滤器加载我的样式表(因为css中引用的图像)

在config.yml

assetic:
debug:          %kernel.debug%
use_controller: false
bundles:        [ cramifviewkitBundle ]
#java: /usr/bin/java
filters:
    cssrewrite: ~
    cssembed:
        jar: %kernel.root_dir%/Resources/java/cssembed-0.4.5.jar
    yui_css:
        jar: %kernel.root_dir%/Resources/java/yuicompressor-2.4.7.jar
    yui_js:
        jar: %kernel.root_dir%/Resources/java/yuicompressor-2.4.7.jar

我下载了cssembed-0.4.5.jar并将其放在 src / my_bundle / Resources / java

在我写的模板中:

{% stylesheets 
    '@myBundle/Resources/public/css/*'
    '@myBundle/Resources/public/JQMenu/css/*'
    filter='cssembed'
%}

第一次导入时一切都很好,但对于第二次导入,当我用firebug看时,我有这个:

<link type="text/css" href="/viewkit/web/app_dev.php/css/eb2d30c_part_1_jqueryMenus_1.css" rel="stylesheet">

当我打开它时,它不是css而是html因为有错误:

<h1>Exception thrown when handling an exception    (Symfony\Component\HttpKernel\Exception\FlattenException: Warning: json_encode() [<a   href='function.json-encode'>function.json-encode</a>]: Invalid UTF-8 sequence in argument in C:\wamp\www\viewkit\vendor\monolog\monolog\src\Monolog\Formatter\NormalizerFormatter.php line 99)</h1>
<div class="block_exception clear_fix">
<h2><span>1/1</span> <abbr title="ErrorException">ErrorException</abbr>: Warning: json_encode() [<a href='function.json-encode'>function.json-encode</a>]: Invalid UTF-8 sequence in argument in  C:\wamp\www\viewkit\vendor\monolog\monolog\src\Monolog\Formatter\NormalizerFormatter.php line 99</h2>
</div>
<div class="block">
 <ol class="traces list_exception">
 <li> in  C:\wamp\www\viewkit\vendor\monolog\monolog\src\Monolog\Formatter\NormalizerFormatter.php line 99</li> 

知道它可能来自哪里?

1 个答案:

答案 0 :(得分:0)

cssembed-0.4.5.jar放在app/Resources/java目录中,如配置中指定的那样。