How to merge an already mined file with grunt-contrib-uglify

5

The situation is as follows, I'm using grunt-contrib-uglify to mine the javascript for my project in a single file, the problem is that one of these files is already mined, and uglify does not add it to my target file, causing syntax error in the project.

The question would be, do you have some way to do grunt-contrib-uglify at least copy the file already mined and join with the others in the final file?

The code for my Gruntfile.js is:

module.exports = function(grunt) {
    grunt.initConfig({
        pkg: grunt.file.readJSON('package.json'),
        skinPath: './skin/frontend/default/<%= pkg.name %>',
        cssmin: {
            combine: {
                files: {
                    '<%= skinPath %>/css/vendor.min.css': [
                        '<%= skinPath %>/css/bootstrap.css',
                        '<%= skinPath %>/css/bootstrap-responsive.css',
                        '<%= skinPath %>/magentothem/**/*.css'
                    ],
                    '<%= skinPath %>/css/styles.min.css': [
                        '<%= skinPath %>/css/styles.css',
                        '<%= skinPath %>/css/widgets.css',
                    ],
                    '<%= skinPath %>/css/print.min.css': [ '<%= skinPath %>/css/print.css' ],
                    '<%= skinPath %>/css/styles-ie.min.css': [ '<%= skinPath %>/css/styles-ie.css' ],
                    '<%= skinPath %>/css/styles-ie8.min.css': [ '<%= skinPath %>/css/styles-ie8.css' ],
                }
            }
        },
        uglify: {
            options: {
                preserveComments: 'all'
            },
            supimpa: {
                src: [
                    './js/prototype/prototype.js',
                    './js/lib/ccard.js',
                    './js/prototype/validation.js',
                    './js/scriptaculous/builder.js',
                    './js/scriptaculous/effects.js',
                    './js/scriptaculous/dragdrop.js',
                    './js/scriptaculous/controls.js',
                    './js/scriptaculous/slider.js',
                    './js/varien/js.js',
                    './js/varien/form.js',
                    './js/varien/menu.js',
                    './js/mage/translate.js',
                    './js/mage/cookies.js',
                    './js/magentothem/ma.jq.slide.js'
                    './js/magentothem/ma.flexslider.js',
                    './js/magentothem/jquery-ui.js'
                ],
                dest: './js/supimpa.min.js'
            }
        },
    });

    grunt.loadNpmTasks('grunt-contrib-uglify');
    grunt.loadNpmTasks('grunt-contrib-cssmin');

    grunt.registerTask('default', ['cssmin', 'uglify']);

};

Since ./js/magentothem/ma.jq.slide.js is already mined, and because of that as I explained earlier it is not added to the ./js/supimpa.min.js file.

Is there any option or method to make it at least add the code in the final file?

    
asked by anonymous 13.03.2015 / 21:39

1 answer

1

Run the task concat before uglify .

link

    
21.05.2015 / 16:33