user1532669
user1532669

Reputation: 2378

Compass can't find any sass files to compile after running grunt

I'm trying to run compass to compile my .scss files. I'm getting the following error:

Running "compass:dist" (compass) task
Compass can't find any Sass files to compile.
Is your compass configuration correct?.
If you're trying to start a new project, you have left off the directory argument.
Run "compass -h" to get help.

Running "watch" task
Waiting...

My .scss files are stored in /myproject/sass/ and /myproject/sass/bootstrap/

I'm expecting the .scss files to be compiled into a minified style.css file.

What do I need to do to sort this?

        compass: {
            dist: {
                options: {
                    sassDir: 'sass',
                    cssDir: 'css'
                }
            }
        },

        watch: {
            css: {
                files: '**/*.scss',
                tasks: ['compass']
            }
        }
    });
    grunt.loadNpmTasks('grunt-contrib-compass');
    grunt.loadNpmTasks('grunt-contrib-watch');
    grunt.loadNpmTasks('grunt-minified');
    grunt.loadNpmTasks('grunt-contrib-concat');
    grunt.loadNpmTasks('grunt-contrib-cssmin');
    grunt.loadNpmTasks('grunt-contrib-uglify');
    grunt.registerTask('default',['concat', 'minified', 'uglify', 'compass', 'watch']);

This might be worth trying:

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

Upvotes: 0

Views: 2721

Answers (1)

user1532669
user1532669

Reputation: 2378

I fixed it by adding this code:

        compass: {
            compile: {
                options: {
                    cssDir: 'css'
                }
            }
        },

This compiles the css (does not minify). I also changed a couple of other values for the files and directories so my grunt file now looks like this:

        compass: {
            dist: {
                options: {
                    sassDir: ['sass/**/*.scss', 'sass/*.scss'],
                    cssDir: 'css/style.css'
                }
            }
        },

        compass: {
            compile: {
                options: {
                    cssDir: 'css'
                }
            }
        },

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

Upvotes: 1

Related Questions