update worker

This commit is contained in:
dengtongyu committed 2018-05-26 18:04:28 +08:00
1 parent b3b4e9e43f
commit d1781f8b1d
5 files changed
+1854 -1041

No files matched your search

+16 -25
View File
@@ -10,7 +10,6 @@ const stylus = require('gulp-stylus');
const swig = require('gulp-swig');
const htmlmin = require('gulp-htmlmin');
const uglify = require('gulp-uglify');
const tmodjs = require('gulp-tmod');
const browserSync = require('browser-sync');
const reload = browserSync.reload;
const proxyMiddleware = require('http-proxy-middleware');
@@ -87,11 +86,22 @@ init = (pathName) => {
.pipe(webpack({
output: {
filename: 'index.js',
},
module: {
rules: [{
test: /\.art$/,
use: [{
loader: 'art-template-loader'
}]
}]
}
}))
.pipe(babel({
presets: ['env']
}))
.pipe(uglify({
ie8: true
}))
//.pipe(webpack( require('./webpack.config.js')(pathConfig.scriptBuildPath) ))
.pipe(gulp.dest(pathConfig.babelOutPath))
.on("end", reload);
@@ -105,29 +115,10 @@ init = (pathName) => {
.pipe(plumber({
errorHandler: onErrorHandler
}))
.pipe(uglify({
ie8: true
}))
.pipe(gulp.dest(config.build))
.on("end", reload);
});
//tmod任务
gulp.task('tmod_build', function() {
//console.log(pathConfig.tmodBuildPath);
return gulp.src(pathConfig.tmodBuildPath)
.pipe(plumber({
errorHandler: onErrorHandler
}))
.pipe(tmodjs({
templateBase: pathConfig.tmodBasePath,
output: pathConfig.tmodOutPath,
combo: false,
type: 'cmd'
}))
.on("end", reload);
});
//watch html任务
gulp.task('html_build', function() {
runSequence('swig_build', 'htmlmin_build');
@@ -136,12 +127,12 @@ init = (pathName) => {
//watch js任务
gulp.task('js_build', function() {
//console.log('执行了js_build')
runSequence('babel_build', 'uglify_build');
runSequence('babel_build');
});
//watch tmodjs任务
gulp.task('tmodjs_build', function() {
runSequence('tmod_build', 'babel_build', 'uglify_build');
gulp.task('art_build', function() {
runSequence('babel_build');
});
//server任务
@@ -177,13 +168,13 @@ init = (pathName) => {
gulp.task('build', function() {
runSequence('stylus_build', 'swig_build', 'htmlmin_build', 'tmod_build', 'babel_build', 'uglify_build', function() {
runSequence('stylus_build', 'swig_build', 'htmlmin_build', 'babel_build', function() {
console.log(chalk.green.bold(pathName + ' 打包完成!'));
});
});
gulp.task('dev', function() {
runSequence('stylus_build', 'swig_build', 'htmlmin_build', 'tmod_build', 'babel_build', 'uglify_build', 'server');
runSequence('stylus_build', 'swig_build', 'htmlmin_build', 'babel_build', 'server');
});
}