gulpfile.js 1006 Bytes
var gulp = require('gulp');
var gutil = require('gulp-util');
var ftp = require('gulp-ftp');
var fs = require('fs');
var exec = require('child_process').exec;
var jshint = require('gulp-jshint');
var stylish = require('jshint-stylish');
var concat = require('gulp-concat');



var ftpConfig = {
    host: '218.94.75.58',
    user: 'php',
    pass: 'yoho9646'
};

gulp.task('default', function() {

});


//js代码验证
gulp.task('lint', function() {
    return gulp.src(['src/*.js', 'src/**/*.js'])
        .pipe(jshint())
        .pipe(jshint.reporter(stylish));
});



//执行spm的build
gulp.task('spm', function(cb) {
    exec('spm build --include standalone', function(err) {
        if (err) return cb(err);
        cb();
    });
});

gulp.task('js', ['spm'], function() {
    console.log("压缩合并完成");
});


//发布到CDN
gulp.task('dist', ['spm'], function() {
    var ftpstream = ftp(ftpConfig);
    return gulp.src('dist/**')
        .pipe(ftpstream)
        .pipe(gutil.noop());
});