Using grunt-contrib-compress in a separate optons file causes "has no method 'indexOf'"warning

71 views Asked by At

I have a grunt file that loads the tasks and options from a sub-directory. The idea was taken from here: http://www.thomasboyt.com/2013/09/01/maintainable-grunt.html

Most of the tasks run fine, with the exception of one using compress with these options:

module.exports = function(grunt, options) {
    return {
        build: {
            options: {
                mode: 'zip',
                archive: '<%= app.name %>.zip',
                pretty: true
            },
            app: {
                files: [{
                    expand: true,
                    cwd: 'build/',
                    src: ['**/*']
                }]
            }
        }
    };
};

I'm not sure if I have defined the target incorrectly, as it appears to follow the rules according to the grunt-contrib-compress FAQ.

There are similar issues on stackoverflow, I have tried the suggested fixes but get the same warning.

What am I doing wrong?

Thanks

1

There are 1 answers

0
Robin Tregaskis On BEST ANSWER

Copy/paste error! I included the function and return lines by mistake, the file should look like this:

module.exports = {
    build: {
        options: {
            mode: 'zip',
            archive: '<%= app.name %>.zip',
            pretty: true
        },
        files: [{
            expand: true,
            cwd: 'build/',
            src: ['**/*']
        }]
    }
};