我正在研究Symfony 3.4和Assetic。假设我的网站是www.mycompany.com,我使用的是两种特定类型的资产:
当我以dev模式访问我的网站时,www.mycompany.com/app_dev.php/:
当我以prod方式访问我的网站时,www.mycompany.com/:
为什么会有这种行为?请注意,我使用Assetic这种方式加载myu资产:
{% stylesheets '@PimInterfaceBundle/Resources/public/css/*' %}
<link rel="stylesheet" href="{{ asset_url }}" />
{% endstylesheets %}
// Same for JS
谢谢。
发布于 2018-01-10 15:27:57
使用cssrewrite过滤器时,不要使用@XxBundle语法引用CSS文件。
尝尝这个
{% stylesheets 'bundles/piminterface/css/*' filter='cssrewrite' %}
<link rel="stylesheet" href="{{ asset_url }}" />
{% endstylesheets %}
这是医生
如果这不适用于您,那么尝试php bin/console asset:install
在prod php bin/console assetic:dump --env=prod --no-debug
‘
https://stackoverflow.com/questions/48184122
复制相似问题