我有以下内容:
//config.yml
# Assetic Configuration
assetic:
debug: %kernel.debug%
write_to: %kernel.root_dir%/../web
use_controller: false
bundles: ['ABundle','BBundle']
java: C:\Program Files (x86)\Java\jre7\bin\java.exe
filters:
cssrewrite: ~
#closure:
# jar: %kernel.root_dir%/Resources/java/compiler.jar
yui_js:
jar: %kernel.root_dir%/Resources/java/yuicompressor-2.4.7.jar
yui_css:
jar: %kernel.root_dir%/Resources/java/yuicompressor-2.4.7.jar
在某些页面中:
{% block stylesheets %}
{% stylesheets '@ABundle/Resources/public/css/x.css'
'@BBundle/Resources/public/css/y.css'
output='css/general.css' filter='yui_css' %}
<link href="{{ asset_url }}" rel="stylesheet" type="text/css" />
{% endstylesheets %}
{% endblock %}
在其他页面中:
{% block javascript %}
{% javascripts
'@ABundle/Resources/public/js/jquery-1.10.2.min.js'
'@ABundle/Resources/public/js/autoNumeric.js'
'@ABundle/Resources/public/js/limiter.js.js'
filter='yui_js'
%}
<script src="{{ asset_url }}" type="text/javascript"></script>
{% endjavascripts %}
{% endblock %}
从提示我使用时:
php app/console cache:clear
php app/console assets:install
最后,
php app/console assetic:dump --env=prod --no-debug
我获得了这个输出:
Dumping all prod assets.
Debug mode is off.
21:39:24 [file+] C:/xampp/htdocs/aplication/app/../web/css/general.css
并完成
为什么资产不会转储js文件? Css文件工作正常,可以访问。
答案 0 :(得分:3)
我无法相信!!!!
在寻找解决方案几个小时之后,问题就是这一行的拼写错误:
'@ABundle/Resources/public/js/limiter.js.js'
我改为:
'@ABundle/Resources/public/js/limiter.js'
所有工作。