gulpfile.js 1.03 KB
/**
 * GULP-FILE
 * author: xuqi(qi.xu@yoho.cn)
 * date: 2015/9/30
 */

var gulp = require('gulp'),
    compass = require('gulp-compass'),
    cp = require('child_process');

gulp.task('default', ['compass', 'compass-watch', 'spm-doc']);

// compass
gulp.task('compass', function() {
    gulp.src('sass/**/*.scss')
        .pipe(
            compass({
                config_file: 'config.rb',
                css: 'css',
                sass: 'sass'
            })
        ).on('error', function(error) {
            console.log(error);
            this.emit('end');
        });
});

// compass watch
gulp.task('compass-watch', function() {
    gulp.watch('sass/**/*.scss', ['compass']);
});

// start spm server
gulp.task('spm-doc', function() {
    var sd = cp.exec('spm doc');

    // sd.stdout.on('data', function(data) {
    //     console.log(data);
    // });

    sd.stderr.on('data', function(data) {
        console.log(data);
    });

    sd.on('exit', function(code) {
        console.log('process spm doc exit with code ' + code);
    });
});