Grunt Concat cannot write to file

Andrew Carreiro picture Andrew Carreiro · Mar 20, 2013 · Viewed 8.4k times · Source

Just installed latest Grunt on Ubuntu 12.04. Here is my gruntfile:

module.exports = function(grunt){
//project configuration
grunt.initConfig({
    pkg: grunt.file.readJSON('package.json'),

    concat: {
        slides :  {
            src : ['src/top.html', 'src/bottom.html'],
            dest : ['build/index.html']
        }
    }
});

//enable plugins
grunt.loadNpmTasks('grunt-contrib');
grunt.registerTask('default', ['concat:slides']);
}

This creates the build/ directory fine, but gives me the output of:

Running "concat:slides" (concat) task Warning: Unable to write "build/index.html" file (Error code: undefined). Use --force to continue.

I tried running chmod 777 on the directory, as I thought it might have something to do with permissions, but that didn't seem to change anything.

How can I make it so Grunt will write to build/index.html?

Answer

Andrew Carreiro picture Andrew Carreiro · Mar 20, 2013

Figured it out:

//Does not work
dest : ['build/index.html']

Works as a string, but not an array:

//Works
dest : 'build/index.html'