webpack学的乱七八糟,回头搞一下Grunt,就还是喜欢简单一点,也可能是我太懒~
module.exports = function (grunt) {
grunt.initConfig({
clean: {
dist: 'dist'
},
// sass编译
sass: {
dist: {
files: [{
expand: true,
cwd: 'css',
src: ['*.scss'],
dest: 'dist/css',
ext: '.css'
}]
}
},
// 检测改变,自动跑sass任务
watch: {
scripts: {
files: ['css/*.scss'],
tasks: ['sass'],
options: {
spawn: false
}
}
}
});
// 引用模块
grunt.loadNpmTasks('grunt-contrib-clean');
grunt.loadNpmTasks('grunt-contrib-sass');
grunt.loadNpmTasks('grunt-contrib-watch');
// 把需要跑的任务注册,监测文件夹的情况。
grunt.registerTask('default', ['clean:dist', 'sass:dist', 'watch:scripts']);
};