1

I want to add Javascript file that should be loaded in dev environment only, not in prod.

{% javascripts '@AppBundle/Resources/public/js/*' %}
<script src="{{ asset_url }}"></script>
{% endjavascripts %}

How can I modify this example to disable it's loading in prod?

1 Answer 1

2

Use {{ app.environment }}

Try this :

{% if app.environment == 'dev' %}
    {% javascripts '@AppBundle/Resources/public/js/*' %}
    <script src="{{ asset_url }}"></script>
    {% endjavascripts %}
{% endif %}
Sign up to request clarification or add additional context in comments.

1 Comment

Thank you, that's what I need.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.