Symfony2.5 and assetic: rewrite javascripts without comments

268 Views Asked by At

As title says, I am using Symfony2.5 and assetic.

Is there a way to exclude comments from being inserted when dumping javascritp files?

For example, in my twig I have something like this:

{% block javascripts %}
    {% javascripts 
        '@MyBundle/Resources/public/js/javascriptfile.js' 
    %}
      <script src="{{ asset_url }}" type="text/javascript"></script>
    {% endjavascripts %}
{% endblock %}

javascriptfile.js contains some commented code (some trial code, comments for readability...) that I would like not to be inserted in the version sent to the final user (first of all, smaller size of pages).

However, everything is copied when doing

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

or

php app/console assetic:dump --env=dev

Is rewriting without comments possible in some way? Even excluding console.logs would be appreciated... Thank you in advance

0

There are 0 best solutions below