I have a grunt file but I am having problems getting it to compile. 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.
Assuming you are using sass files, you have to change your code to something like this:
sass: {
dist: {
files: [
{
expand: true,
cwd: "public/sass",
src: ["**/*.sass"],
dest: "public/stylesheets",
ext: ".css"
}
]
}
},
watch: {
css: {
files: '**/*.sass',
tasks: ['sass']
}
}
Regards.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.