Referring to Grunt targets resulting in Warning: Object true has no method 'indexOf'

gruntjs

Solution

I ran into a similar problem with contrib-concat. I think it's a syntax error on both our parts.

Try adding an array literal around your development target's "files" property, like so:

files: [{
    //'<%= less_build_path %>/app.css':'<%= concat.less.dest %>',
    //Dynamic expansion 1:1
    expand: true,
    cwd:    '<%= less_src_path %>',
    dest:   '<%= less_build_path %>',
    src:    '*.less',
    ext:    '.less.css'
}]

Here's the doc: http://gruntjs.com/configuring-tasks#building-the-files-object-dynamically

Hope that helps!

Problem

My Code: ``` 'use strict'; module.exports = function(grunt) { // Project configuration. grunt.initConfig({ pkg: grunt.file.readJSON('package.json'), //Define paths js_src_path: 'webapp/js', js_build_path: 'webapp/js', css_src_path: 'webapp/css', css_build_path: 'webapp/css', less_src_path: 'webapp/less', less_build_path:'webapp/less', //Convert Less to CSS and minify if compress = true less: { development: { options: { path: ['<%= less_src_path %>'], }, files: { //'<%= less_build_path %>/app.css':'<%= concat.less.dest %>', //Dynamic expansion 1:1 expand: true, cwd: '<%= less_src_path %>', dest: '<%= less_build_path %>', src: '*.less', ext: '.less.css' } }, production: { options: { path: ['<%= less_src_path %>'], //compress: true yuicompress: true }, files: { //'<%= less_build_path %>/app.css':'<%= concat.less.dest %>', //Dynamic expansion 1:1 expand: true, cwd: '<%= less_src_path %>', dest: '<%= less_build_path %>', src: '*.less', ext: '.less.min.css' } } } }); // Load the plugin that provides the tasks. grunt.loadNpmTasks('grunt-lib-contrib'); grunt.loadNpmTasks('grunt-contrib-less'); // Task(s). grunt.registerTask('les', ['less']); grunt.registerTask('proless', ['less:production']); grunt.registerTask('devless', ['less:devevelopment']); }; ``` Running each of the following: ``` grunt les grunt proless grunt devless ``` Results in: ``` Warning: Object true has no method 'indexOf' Use --force to continue ``` If I remove the task `development:{ ... }` and `production: { .... }` and leave the interior and just change my `les` call to hit `less` it works fine.

Original source