JSous
JSous

Reputation: 1037

Grunt with compass not compiling

Hi I'm new to grunt and I'm having a problem getting it up and running with compass.

This is my Gruntfile:

module.exports = function(grunt) {

    // Project configuration.
    grunt.initConfig({

        //Read the package.json (optional)
        pkg: grunt.file.readJSON('package.json'),

        // Metadata.
        meta: {
            sassPath: 'templates/sass/',
            cssPath: 'public/css/',
        },

        // Task configuration.
        compass: {
            dist: {
                files: {
                    '<%= meta.cssPath %>*.css': '<%= meta.sassPath %>**/*.scss'
                }
            }
        },

    });

    // These plugins provide necessary tasks.
    grunt.loadNpmTasks('grunt-contrib-compass');

    // Default task.
    grunt.registerTask('default', ['compass']);

}

But when I run grunt --verbose I get this:

...
Running "default" task

Running "compass" task

Running "compass:dist" (compass) task
Verifying property compass.dist exists in config...OK
Files: templates/sass/ie.scss, templates/sass/print.scss, templates/sass/screen.scss, templates/sass/style.scss -> public/css/*.css
Options: (none)
Nothing to compile. If you're trying to start a new project, you have left off the directory argument.
Run "compass -h" to get help.

Done, without errors.

So it looks like it sees the files, and even sees where to put them... what is going wrong?

EDIT: Just so people know the final answer... I thought I had tried this before without success, but this morning I ended up getting this to work:

    compass: {
        dist: {
              expand: true,
              cwd: '<%= meta.scssPath %>',
              src: ['{,*/}*.scss'],
              dest: '<%= meta.cssPath %>',
              ext: '.css'
        }
    },

EDIT 2: Okay, for the life of me don't know why, but it only works when a config.rb was present... why would grunt use the compass config is another question...

Upvotes: 0

Views: 1199

Answers (1)

Jordan Kasper
Jordan Kasper

Reputation: 13273

I think the issue is your destination file. You have to specify an actual file, not *.css. Try tweaking your config slightly:

compass: {
    dist: {
        files: {
            '<%= meta.cssPath %>compiled.css': '<%= meta.sassPath %>**/*.scss'
        }
    }
}

Upvotes: 1

Related Questions