Search code examples
symfonyuglifyjsuglifycss

The combined file is not being included in production


I'm using uglifyjs and uglifycss with symfony to manage my asset. I have a strange issue. Here is my configuration

# Assetic Configuration
assetic:
     debug:          "%kernel.debug%"
     use_controller: false
     bundles:        [ ]
     filters:
        cssrewrite: ~
        uglifyjs2:
                # the path to the uglifyjs executable
                bin: "%kernel.root_dir%/Resources/node_modules/uglify-js/bin/uglifyjs"
        uglifycss:
                bin: "%kernel.root_dir%/Resources/node_modules/uglifycss/uglifycss"

And in my view

{% javascripts
        '@MyBundle/Resources/public/js/global.js'
        '@MyBundle/Resources/public/utilis/*.js'
        '@MyBundle/Resources/public/utilis/*/*.js'
        '@MyBundle/Resources/public/js/*.js'
        '@MyBundle/Resources/public/js/*/*.js'
        filter='?uglifyjs2' %}

        <script src="{{ asset_url }}"></script>

 {% endjavascripts %}

With this I expect to have only one file minified included in my page. On my development machine (Windows 7, php 5.4, symfony 2.7) everything is working fine. But on production environment (debian 7, php5.4, symfony 2.7), all individual file is being included in the page.

<script src="/js/e434957_part_14_Store_1.js"></script>
<script src="/js/e434957_part_15_CrudPanel_2.js"></script>
<script src="/js/e434957_part_15_Form_3.js"></script>
<script src="/js/e434957_part_15_Grid_4.js"></script>

Can somebody help me understand what is going on?


Solution

  • When you dump the assets, make sure you add --env=prod to the assetic:dump command.

    You can also force files combining with combine=true parameter. But it should be set on true automatically on production env.