Reputation: 1279
Hi I'm using Grunt to compile my less code to CSS. To see if I have made changes to my .less file I use:
grunt watch
After doing that, I was editing my .less file. But nothing happens in cmd I still see that he is watching to my .less file. Here is a screenshot of it:
link: https://i.sstatic.net/b25B3.png
Here is the code that I use:
gruntfile.js:
module.exports = function(grunt) {
grunt.initConfig({
less: {
development: {
options: {
compress: true,
yuicompress: true,
optimization: 2
},
files: {
"css/styles.css": "css/styles.less" // destination file and source file
}
}
},
watch: {
styles: {
files: ['less/styles.less'], // which files to watch
tasks: ['less'],
options: {
nospawn: true
}
}
}
});
grunt.loadNpmTasks('grunt-contrib-less');
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.registerTask('default', ['less', 'watch']);
};
package.json:
{
"name": "Coming_soon_code",
"version": "0.0.0",
"description": "van een tut",
"main": "gruntfile.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "",
"license": "BSD-2-Clause",
"devDependencies": {
"grunt": "~0.4.5",
"grunt-contrib-less": "~1.0.0",
"grunt-contrib-watch": "~0.6.1"
}
}
Also here is a screenshot of my folder structure in case if you need it:
link: https://i.sstatic.net/fLCmd.png
Upvotes: 0
Views: 125
Reputation: 13273
You appear to be "watching" the 'less/styles.less'
file... but that is not the correct directory according to your screenshot or less
task config, it's in the css
directory. Try this maybe:
watch: {
styles: {
files: ['css/styles.less'], // <-- changed the directory here...
tasks: ['less'],
options: {
nospawn: true
}
}
}
Upvotes: 1