forked from kahlil/grunt-compass
/
grunt-compass.js
30 lines (23 loc) · 896 Bytes
/
grunt-compass.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
module.exports = function( grunt ) {
// Create a new task.
grunt.registerTask( 'compass', 'This triggers the `compass compile` command.', function() {
var exec = require('child_process').exec,
command = "compass compile",
src = grunt.config('compass.src'),
dest = grunt.config('compass.dest');
if (src !== undefined &&
dest !== undefined) {
command += ' --sass-dir="' + src + '" --css-dir="' + dest + '"';
}
function puts( error, stdout, stderr ) {
grunt.log.write( '\n\nCOMPASS output:\n' );
grunt.log.write( stdout );
grunt.log.error( stderr );
if ( error !== null ) {
grunt.log.error( error );
}
}
exec( command, puts );
grunt.log.write( '`' + command + '` was initiated.' );
});
};