My "grunt watch" is running but it doesn't apply the changes from SCSS to CSS

226 Views Asked by At

I'm currently having a problem with my grunt watch command. It appears to be running and is listening to the changes but it doesn't apply them. I need to change my scss to css. I'm very new to all of this and I'm following every step they gave me but it just doesn't work. Can someone please take a look and help me?

I decided to keep going and added the browsersync task and is showing me that my file css has changed but is not true.

This is the code of my gruntfile:

module.exports = function (grunt){
    grunt.initConfig({
        sass:{
            dist:{
                files: [{
                    expand: true,
                    cwd: 'css',
                    src: ['*.scss'],
                    dest: 'css',
                    ext: '.css'
                }]
            }
        },

        watch: {
            files: ['css/*.scss'],
            task: ['css']
        },

        browserSync: {
            dev: {
                bsFiles: { //browserfiles
                    src: [
                        'css/*.css',
                        '*.html',
                        'js/*.js'
                    ]
                },
                options: {
                    watchTask: true,
                    server: {
                        baseDir: './' 
                    }
                }

            }
        },
    });

    grunt.loadNpmTasks('grunt-contrib-watch');
    grunt.loadNpmTasks('grunt-contrib-sass');
    grunt.loadNpmTasks('grunt-browser-sync');
    grunt.registerTask('css', ['sass']);
    grunt.registerTask('default', ['browserSync', 'watch'])

};

This is my package.json:

"copyfiles": "^2.4.0",
"cssmin": "^0.4.3",
"grunt": "^1.3.0",
"grunt-browser-sync": "^2.2.0",
"grunt-contrib-sass": "^2.0.0",
"grunt-contrib-watch": "^1.1.0",
"htmlmin": "0.0.7",
"lite-server": "^2.5.4",
"node-sass": "^5.0.0",
"ruby": "^0.6.1",
"uglifyjs": "^2.4.11",
"usemin-cli": "^0.6.0"

is watching but is not doing nothing. I have windows10. pd: sorry for my english. hope someone can shine a light here.

1

There are 1 best solutions below

0
On

Everything is fine. You just have a typo correct that typo.it will work fine. Inside watch it should be tasks: not task: