##Install
1 - Node + NPM: http://nodejs.org/download/
2 - Ruby: http://rubyinstaller.org/downloads/
3 - Run:
gem install compass-sourcemaps --pre
npm install grunt-contrib-watch grunt-contrib-compass --save
// create Gruntfile.js as below, then proceed to next line
grunt init
##Gruntfile.js
grunt.initConfig({
compass: {
styles: {
options: {
raw: 'sass_options = {:sourcemap => true}\n',
sassDir: 'scss',
cssDir: 'css',
outputStyle: 'expanded',
assetCacheBuster: false
}
}
},
compass_is_fixed: false,
watch: {
styles: {
files: ['scss/**/*.scss'],
tasks: ['compass:styles']
}
}
});
grunt.registerTask('default', ['watch']);
grunt.registerTask('init', ['compass-fix', 'default']);
grunt.registerTask('compass-fix', 'Fix compass -> sourcemap compatibility', function(){
if (!grunt.config('compass_is_fixed')) {
var filename = 'node_modules/grunt-contrib-compass/tasks/compass.js',
contents = grunt.file.read(filename);
contents = contents.replace(/if\s+\(\!options\.clean\)\s+\{\s+options.time\s+\=\s+true\;\s+\}/,'//if (!options.clean) {options.time = true;}');
grunt.file.write(filename, contents);
grunt.config('compass_is_fixed', true);
}
});