[英]Trying to compile all scss files into one css file
I have a grunt file but I am having problems getting it to compile. 我有一个grunt文件,但我在编译时遇到问题。 When I watch it it appears to run fine but does not produce any files. 当我观看它似乎运行正常但不产生任何文件。
What am I missing? 我错过了什么?
module.exports = function(grunt) {
grunt.initConfig({
pngmin: {
compile: {
options: {
ext: '.png',
force: true,
speed: 3,
colors: 200
},
files: [{
expand: true, // required option
src: ['**/*.png'],
cwd: 'public/images/src/', // required option
dest: 'public/images/dist/'
}]
}
},
sass: {
dist: {
files: [
{
expand: true,
cwd: "public/sass",
src: ["**/*.sass"],
dest: "public/stylesheets",
ext: ".css"
}
]
}
},
watch: {
css: {
files: '**/*.scss',
tasks: ['sass']
}
}
});
grunt.loadNpmTasks('grunt-contrib-sass');
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-pngmin');
grunt.registerTask('default', ['pngmin', 'watch', 'sass']);
};
You are watching scss files, but you have sass files in your sass task. 你正在看scss文件,但你的sass任务中有sass文件。
Assuming you are using sass files, you have to change your code to something like this: 假设您使用的是sass文件,则必须将代码更改为以下内容:
sass: {
dist: {
files: [
{
expand: true,
cwd: "public/sass",
src: ["**/*.sass"],
dest: "public/stylesheets",
ext: ".css"
}
]
}
},
watch: {
css: {
files: '**/*.sass',
tasks: ['sass']
}
}
Regards. 问候。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.