简体   繁体   中英

SASS Grunt error

I try to added the Sass task to my grunt process using the grunt-contrib-sass plugin but when i run it he create the css files but this file is empty

This is my Gruntfile.js :

module.exports = function(grunt){
grunt.initConfig({
        pkg: grunt.file.readJSON('package.json'),
        sass: {
            dist: {
                options: {
                    style:'expanded',
                    trace: true
                },

                files: {
                    'main.css':'sass/app.scss'
                }
            }
        },

        watch: {
            css: {
                files: '**/*.scss',
                tasks: ['sass']
            }
        }
    });

    grunt.loadNpmTasks('grunt-contrib-sass');
    grunt.loadNpmTasks('grunt-contrib-watch');
    grunt.registerTask('default', ['watch']);
};

When i start the command "grunt" i have this :

Running "watch" task
Waiting.....
File "sass\\app.scss" changed
Running "sass:dist" task
(and nothing)

I have :

  • Ruby 2.1.5 [x64-mingw32]
  • SASS : 3.4.10
  • Grunt : newest version

Thanks !

Could you try changing this:

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

To this:

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

To make sure it watches from the root of the project

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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM