2014-05-01 17 views
7

Sono nuovo di Grunt. Ho pensato di fare un tentativo, quindi ho creato questo file grunt.Il file grunt fallisce "Interrotto a causa di avvertimenti"

module.exports = function(grunt) { 

    grunt.initConfig({ 

     pkg: grunt.file.readJSON('package.json'), 

     concat: { 
      css: { 
       src: [ 
        './css/*' 
       ], 
       dest: './css/all.css' 
      }, 
      js: { 
       src: [ 
        './js/*' 
       ], 
       dest: './js/all.js' 
      } 
     }, 

     uglify: { 
      js: { 
       files: { 
        './js/build/all.min.js': ['./js/all.js'] 
       } 
      } 
     }, 

     sass: { 
      build: { 
       files: [{ 
        expand: true, 
        cwd: './css/sass', 
        src: ['*.scss'], 
        dest: './css', 
        ext: '.css' 
       }] 
      } 
     }, 

     cssmin: { 
      css: { 
       src: './css/all.css', 
       dest: './css/build/all.min.css' 
      } 
     }, 

     watch: { 
      files: ['./css/sass/*', './js/*'], 
      tasks: ['sass:build','concat:css', 'cssmin:css', 'concat:js', 'uglify:js'] 
     } 

    }); 

    grunt.loadNpmTasks('grunt-contrib-uglify'); 
    grunt.loadNpmTasks('grunt-contrib-watch'); 
    grunt.loadNpmTasks('grunt-contrib-sass'); 
    grunt.loadNpmTasks('grunt-contrib-cssmin'); 
    grunt.loadNpmTasks('grunt-contrib-concat'); 

    grunt.registerTask('dev', ['sass:build','concat:css', 'cssmin:css', 'concat:js', 'uglify:js']); 

}; 

Quando eseguo 'orologio grunt' e fare una modifica a un file di .scss, terminale si lamenta e poi si interrompe.

Running "watch" task 
Waiting... 
>> File "css/sass/all.scss" changed. 
Running "sass:build" (sass) task 
File css/all.css created. 

Running "concat:css" (concat) task 
Warning: Unable to read "./css/build" file (Error code: EISDIR). Use --force to continue. 

Aborted due to warnings. 
Completed in 1.276s at Thu May 01 2014 23:53:59 GMT+0100 (BST) - Waiting... 

Per favore qualcuno può indicare dove sto andando male?

Sembra essere con il concat:css - ma non c'è alcun riferimento alla directory di compilazione lì.

Credo che potrebbe essere perché alcuni compiti sono in collisione e i file non sono ancora pronti per essere lavorato con forse? Esiste un ordine per le attività?

Per favore, sopportami visto che è tutto nuovo!

Grazie, Michael.

risposta

7

Ho notato che è piuttosto vecchio, ma aggiungerò una risposta per i posteri.

Mi stava succedendo a causa di una variabile mancante nel file SASS.

Prova ad aggiungere "--force" al comando grunt. La compilazione fallirà, ma probabilmente riceverai un messaggio di errore più utile.

3

provare ad aggiungere l'opzione nospawn: true nelle opzioni di attività sass.

Inoltre, se si vuole avere una risposta di errore più completo è possibile eseguire grunt --verbose

Problemi correlati