我使用以下grunt任务
咕噜-SASS 咕噜-的contrib手表 咕噜,autoprefix 节点波旁
(还有一些其他的任务,比如uglify,spritesmith和haml,我已经在这个例子中遗漏了)
我的grunt文件如下所示:
module.exports = function(grunt) {
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
sass: {
options: {
sourceMap: true,
outputStyle: 'compressed',
imagePath: 'assets/css/img',
includePaths: require('node-bourbon').includePaths
},
dist: {
files: {
'assets/css/app.css': 'assets/sass/app.scss'
}
}
},
autoprefixer: {
options: {
browsers: ['last 2 version', 'ie 8', 'ie 9'],
silent : false
},
dev: {
src: 'assets/css/app.css',
dest: 'assets/css/post.css'
},
},
watch: {
options: {
livereload: true
},
sass: {
files: ['assets/sass/**/*.scss', 'assets/sass/*.scss'],
tasks: ['sass:dist', 'autoprefixer:dev']
}
}
});
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-sass');
grunt.loadNpmTasks('grunt-autoprefixer');
grunt.registerTask('default', ['watch', 'sass']);
};
这很有效。但是,如果我的sass文件中有错误,则不会报告任何内容。例如,如果我尝试使用不存在的$变量,我的终端中不会报告错误
这是两个后续日志,第一个成功编译,没有错误。第二个没有编译(因为scss文件中有一个未定义的变量)
Completed in 1.712s at Sun Sep 28 2014 15:23:17 GMT+0100 (GMT Daylight Time) - Waiting...
>> File "assets\sass\app.scss" changed.
Running "sass:dist" (sass) task
File assets/css/app.css created.
File assets/css/app.css.map created.
Running "autoprefixer:dev" (autoprefixer) task
File assets/css/post.css created.
Done, without errors.
C:\wamp\www\_bp2>grunt
Running "watch" task
Waiting...
>> File "assets\sass\app.scss" changed.
Running "sass:dist" (sass) task
Completed in 1.656s at Sun Sep 28 2014 15:29:25 GMT+0100 (GMT Daylight Time) - Waiting...
有谁知道为什么没有记录错误?
我正在重建我的sass样板以使用libsass和bourbon而不是指南针。因此,我希望在此过程中遇到大量错误,所以我真的需要知道这些错误是什么。
由于