语法错误在哪里? (gruntfile.js)
Where is the Syntax Error? (gruntfile.js)
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');
};
我不明白javascript,但这次我必须处理它。
请帮我挑错:)
这是我的错误消息:
Loading "gruntfile.js" tasks...ERROR
SyntaxError: Unexpected identifier
Warning: Task "sass" not found. Use --force to continue.
Aborted due to warnings.
您在 watch
目标中缺少一个逗号:
watch: {
css: {
files: 'sites/all/themes/uj/sass/**/*.scss',
tasks: [ 'sass:dev' ], //<-- missing comma added here
options: { livereload: true }
}
同时删除空加载调用:grunt.loadNpmTasks('');
它是多余的。
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');
};
我不明白javascript,但这次我必须处理它。 请帮我挑错:)
这是我的错误消息:
Loading "gruntfile.js" tasks...ERROR SyntaxError: Unexpected identifier Warning: Task "sass" not found. Use --force to continue.
Aborted due to warnings.
您在 watch
目标中缺少一个逗号:
watch: {
css: {
files: 'sites/all/themes/uj/sass/**/*.scss',
tasks: [ 'sass:dev' ], //<-- missing comma added here
options: { livereload: true }
}
同时删除空加载调用:grunt.loadNpmTasks('');
它是多余的。