Symfony Assetic - part_1 in url

╄→гoц情女王★ 提交于 2019-12-08 17:15:00

问题


Okay so I've been searching all over for some input into this but haven't found anything to help directly (only mentions of this problem in relation to something else).

Basically I'm having problems with the path assetic generates when looking for an assetic file versus what is actually generated.

The path it's trying to load is: /js/admin_part_1.js whereas the file it is generating is simply /js/admin.js

I am dumping files with:

php app/console assetic:dump --env=prod --no-debug

Relevant portion of the config.yml:

assetic:
debug:          "%kernel.debug%"
use_controller: false
filters:
    cssrewrite: ~
assets:
    admin_js:
        inputs:
            - @UserBundle/Resources/js/admin-tools.js
        output: js/admin.js

Loading the javascript tag via:

{% javascripts '@admin_js' output='js/admin.js' %}
<script type="text/javascript" src="{{ asset_url }}"></script>
{% endjavascripts %}

My question is, where is this phantom _part_1 coming from and how can I tell it stop adding it in?


回答1:


Where is it coming from?

Well, in the current() method in Assetic/Asset/Iterator/AssetCollectionIterator.php on line 67 (current master).

How do I get rid of it?

The 'part_#' string is added in the development environment. When you dump the assets, make sure you add --env=prod to the assetic:dump command. Make sure you use app_dev.php to access the page.



来源:https://stackoverflow.com/questions/19057196/symfony-assetic-part-1-in-url

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!