2014-04-09 25 views
12

Sto sperimentando con Grunt e sto ricevendo un avviso: errore "predefinito" non rilevato quando si tenta di eseguire Grunt. la mia Gruntfile.js èAvviso grunt: attività "predefinita" non trovata

module.exports = function(grunt) { 

grunt.initConfig({ 
concat: { 
    js: { 
    options: { 
     separator: ';' 
    }, 
    src: [ 
     'library/js/*.js' 
    ], 
    dest: 'library/js/scripts.min.js' 
    }, 
}, 

uglify: { 
    options: { 
    mangle: false 
    }, 
    js: { 
    files: { 
     'library/js/scripts.min.js': ['library/js/scripts.min.js'] 
    } 
    } 
}, 

less: { 
    style: { 
    files: { 
     "library/css/style.css": "library/less/style.less" 
    }, 
    } 
}, 

watch: { 
    js: { 
    files: ['library/js/*.js'], 
    tasks: ['concat:js', 'uglify:js'], 
    options: { 
     livereload: 35729 
    } 
    }, 
    css: { 
    files: ['library/less/*.less'], 
    tasks: ['less:style'], 
    options { 
     livereload: 35729 
    } 
    }, 
    php : { 
    files : ['**/*.php'], 
    options : { 
     livereload : 35729 
     } 
    } 
} 
    }); 



grunt.loadNpmTasks('grunt-contrib-concat'); 
    grunt.loadNpmTasks('grunt-contrib-uglify'); 
    grunt.loadNpmTasks('grunt-contrib-less'); 
    grunt.loadNpmTasks('grunt-contrib-watch'); 
    grunt.registerTask('default', ['watch']); 
}; 

Questo stava lavorando fino a quando ho aggiunto le porzioni Livereload, e penso che potrebbe essere un errore di sintassi. Tuttavia questa è la prima volta che ho usato questo e semplicemente non so che cosa sta causando il problema. Qualsiasi aiuto sarebbe molto apprezzato.

risposta

7

Ti manca il due punti per watch.css.options. Aggiornamento per:

css: { 
    files: ['library/less/*.less'], 
    tasks: ['less:style'], 
    options: { 
     livereload: 35729 
    } 
} 
+0

Grazie che ha risolto il tutto per me. Sto ancora avendo problemi a far funzionare il fegato, ma questo è un altro problema. – micahmills

1

Nel caso in cui qualcuno trova questo più tardi per ottenere livereload a lavorare ho dovuto cambiare la sezione orologio per

watch: { 
    js: { 
    files: ['library/js/*.js'], 
    tasks: ['concat:js', 'uglify:js'], 
    }, 
    css: { 
    files: ['library/less/*.less'], 
    tasks: ['less:style'], 
    }, 
    php : { 
    files: ['**/*.php'], 
    }, 
    options: { 
     livereload: true, 
     spawn: false 
    } 
} 
Problemi correlati