Grunt:Compass、CoffeeScript、CSS圧縮を実行するGruntfile設定

module.exports = function (grunt) {
    var pkg = grunt.file.readJSON('package.json');
    grunt.initConfig({
        compass: {
            dist: {
                options: {
                    config: 'config.rb'
                }
            }
        },
        cssmin: {
            compress: {
                files: {
                    '(圧縮後CSS出力パス)/*-min.css': ['(圧縮前CSSパス)/*.css']
                }
            }
        },
        coffee: {
            compile: {
                files: {
                    '(出力.jsフォルダパス)/*.js': ['(.coffeeフォルダパス)/*.coffee']
                }
            }
        },
        watch: {
            files: ['(.scssフォルダパス)/*.scss','(.coffeeフォルダパス)/*.coffee'],
            tasks: ['compass','coffee','cssmin']
        }
    });

    var taskName;
    for (taskName in pkg.devDependencies) {
        if (taskName.substring(0, 6) == 'grunt-') {
            grunt.loadNpmTasks(taskName);
        }
    }
    grunt.registerTask('default', ['watch']);
};