[英]Assetic: how to include javascript file only for dev environment?
I want to add Javascript file that should be loaded in dev environment only, not in prod. 我想添加只应在开发环境中而不是在生产环境中加载的Javascript文件。
{% javascripts '@AppBundle/Resources/public/js/*' %}
<script src="{{ asset_url }}"></script>
{% endjavascripts %}
How can I modify this example to disable it's loading in prod? 如何修改此示例以禁用其在产品中的加载?
Use {{ app.environment }}
使用
{{ app.environment }}
Try this : 尝试这个 :
{% if app.environment == 'dev' %}
{% javascripts '@AppBundle/Resources/public/js/*' %}
<script src="{{ asset_url }}"></script>
{% endjavascripts %}
{% endif %}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.