assetics in prod env not working like in dev env

179 views Asked by At

i'm developping a symfony application using assetics. when i dump assets

assetic:dump

then i deleted cache manually.

there is no problem all is done correctely. dev env turns correctely too. but when i use prod env i have some js errors. some functions are not readed.

 $(...).mask is not a function

,

Cannot read property 'getWidthFrom' of undefined

,

timeLeft is not defined

I don't know why in dev env is working but not the same case for prod env. any one to help me?

2

There are 2 answers

0
walidtlili On BEST ANSWER
    {% block js %}

{{parent()}}
        {% javascripts output="js/compiled/main.js"
        'bundles/sbcplatform/bower_components/datatables/media/js/jquery.dataTables.min.js'
        'bundles/sbcplatform/bower_components/datatables-buttons/js/dataTables.buttons.js'
        'bundles/sbcplatform/assets/js/custom/datatables/buttons.uikit.js'
        'bundles/sbcplatform/bower_components/jszip/dist/jszip.min.js'
        'bundles/sbcplatform/bower_components/pdfmake/build/pdfmake.min.js'
        'bundles/sbcplatform/bower_components/pdfmake/build/vfs_fonts.js'
        'bundles/sbcplatform/bower_components/datatables-buttons/js/buttons.colVis.js'
        'bundles/sbcplatform/bower_components/datatables-buttons/js/buttons.html5.js'
        'bundles/sbcplatform/bower_components/datatables-buttons/js/buttons.print.js'
        'bundles/sbcplatform/assets/js/custom/datatables/datatables.uikit.min.js'
        'bundles/sbcplatform/assets/js/pages/plugins_datatables.min.js' %}
        <script src="{{ asset_url }}"></script>
        {% endjavascripts %}
    {% endblock %}

I have just deleted {{parent()}} because of it symfony generate two calls of main.js and that cause this problem

1
Jasmin Mistry On

try

php app/console cache:clear --env=prod && php app/console assets:install && php app/console assetic dump --env=prod