...
|
...
|
@@ -5,8 +5,8 @@ var fs = require('fs'); |
|
|
var exec = require('child_process').exec;
|
|
|
var jshint = require('gulp-jshint');
|
|
|
var stylish = require('jshint-stylish');
|
|
|
|
|
|
|
|
|
const webpack = require('webpack');
|
|
|
const webpackConfig = require('./webpack.config.js');
|
|
|
|
|
|
var ftpConfig = {
|
|
|
host: '218.94.75.58',
|
...
|
...
|
@@ -18,7 +18,6 @@ gulp.task('default', function() { |
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
//js代码验证
|
|
|
gulp.task('lint', function() {
|
|
|
return gulp.src(['src/*.js', 'src/**/*.js'])
|
...
|
...
|
@@ -27,24 +26,20 @@ gulp.task('lint', function() { |
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
//执行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() {
|
|
|
gulp.task('dist', ['build'], function() {
|
|
|
var ftpstream = ftp(ftpConfig);
|
|
|
return gulp.src('dist/**')
|
|
|
.pipe(ftpstream)
|
|
|
.pipe(gutil.noop());
|
|
|
});
|
|
|
|
|
|
gulp.task('build', function(done) {
|
|
|
webpack(webpackConfig, function(err, stats) {
|
|
|
if (err) {
|
|
|
throw new gutil.PluginError('webpack', err);
|
|
|
}
|
|
|
gutil.log('[webpack compile]:', stats.endTime - stats.startTime, 'ms');
|
|
|
done();
|
|
|
});
|
|
|
}); |
|
|
\ No newline at end of file |
...
|
...
|
|