2017-03-02 1 views
2
module.exports = function(grunt) { 
// Project configuration. 
grunt.initConfig({ 
    pkg: grunt.file.readJSON('package.json'), 
    connect: { 
    uses_defaults: {} 
    }, 
    sass: { 
    dev: { 
     options: { sourceMap: true }, 
     files: { 'sites/all/themes/uj/css/uj.styles.css' : 'sites/all/themes/uj/sass/uj.styles.scss' }  
    } 
    }, 
    watch: { 
    css: { 
     files: 'sites/all/themes/uj/sass/**/*.scss', 
     tasks: [ 'sass:dev' ] 
     options: { livereload: true } 
} 
} 



}); 
// Load Grunt plugins 
grunt.loadNpmTasks(''); 
// Default task(s). 
grunt.registerTask('default', []); 



// Load Grunt plugins 
grunt.loadNpmTasks('grunt-contrib-connect'); 
grunt.loadNpmTasks('grunt-sass'); 
grunt.loadNpmTasks('grunt-contrib-watch'); 


}; 

Je ne comprends pas javascript, mais je dois gérer cette fois-ci. S'il vous plaît choisir l'erreur pour moi :)Où est l'erreur de syntaxe? (gruntfile.js)

Ceci est mon errormessage:

Loading "gruntfile.js" tasks...ERROR SyntaxError: Unexpected identifier Warning: Task "sass" not found. Use --force to continue.

Aborted due to warnings.

Répondre

1

Il vous manque une virgule dans la cible watch:

watch: { 
    css: { 
     files: 'sites/all/themes/uj/sass/**/*.scss', 
     tasks: [ 'sass:dev' ], //<-- missing comma added here 
     options: { livereload: true } 
} 

supprimer également l'appel de charge vide: grunt.loadNpmTasks(''); c'est redondant.

+0

Oui, cela fonctionne maintenant. Je vous remercie!! – Ayala