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']);
};
scss is compiled into CSS when you save your project manually or automatically and how the changes to _grid.
Sass Importing Files Just like CSS, Sass also supports the @import directive. The @import directive allows you to include the content of one file in another.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With