gulpfile.js 1011 Bytes
/**
 * gulp file 执行compass解析,spm build以及文件合并压缩等
 * author: xuqi(qi.xu@yoho.cn)
 * date; 2015/3/27
 */
var gulp = require('gulp'),
    fs = require('fs'),
    exec = require('child_process').exec,
    concat = require('gulp-concat');
    
var config = JSON.parse(fs.readFileSync('./package.json').toString());
//spm build
gulp.task('build', function() {
    exec('spm build', function() {
        //development ENV
        gulp.src('dist/yoho-mobile.js')
            .pipe(concat('libs-dev.js'))
            .pipe(gulp.dest('../mobile/public/dist/'));
        //production ENV
        gulp.src(['sea/sea.js', 'dist/yoho-mobile.js'])
            .pipe(concat('libs.js'))
            .pipe(gulp.dest('../mobile/dist/' + config.name + '/' + config.version + '/'));
        gulp.src(['sea/sea-debug.js', 'dist/yoho-mobile-debug.js'])
            .pipe(concat('libs-debug.js'))
            .pipe(gulp.dest('../mobile/dist/' + config.name + '/' + config.version + '/'));
        });
});