update worker
This commit is contained in:
1 parent
b3b4e9e43f
commit
d1781f8b1d
5 files changed
+1853
-1040
No files matched your search
Generated
+1828
-1002
File diff suppressed because it is too large.
Load diff
+4
-2
@@ -22,16 +22,18 @@
|
||||
"gulp-plumber": "^1.2.0",
|
||||
"gulp-stylus": "^2.7.0",
|
||||
"gulp-swig": "^0.8.0",
|
||||
"gulp-tmod": "^2.0.3",
|
||||
"gulp-uglify": "^3.0.0",
|
||||
"http-proxy-middleware": "^0.17.4",
|
||||
"run-sequence": "^2.2.1",
|
||||
"webpack-stream": "^4.0.3"
|
||||
},
|
||||
"dependencies": {
|
||||
"art-template-loader": "^1.4.3",
|
||||
"browser-demote": "^1.0.6",
|
||||
"chalk": "^2.4.1",
|
||||
"commander": "^2.15.1",
|
||||
"gulp-contrib-copy": "^0.1.3",
|
||||
"inquirer": "^5.2.0"
|
||||
"inquirer": "^5.2.0",
|
||||
"webpack": "^4.9.1"
|
||||
}
|
||||
}
|
||||
+16
-25
@@ -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');
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
+1
-3
@@ -37,9 +37,7 @@ exports.initPath = (pathName) => {
|
||||
_pathConfig.uglifyBuildPath = _config.build + '/pages/' + pathName + '/index.js';
|
||||
|
||||
//tmod build目录
|
||||
_pathConfig.tmodBuildPath = _config.base + '/pages/' + pathName + '/**/*.tmod';
|
||||
_pathConfig.tmodBasePath = _config.base + '/pages/';
|
||||
_pathConfig.tmodOutPath = _config.base + '/script/tmodjs/';
|
||||
_pathConfig.artBuildPath = _config.base + '/pages/' + pathName + '/**/*.art';
|
||||
|
||||
return _pathConfig;
|
||||
}
|
||||
|
||||
+4
-8
@@ -29,17 +29,13 @@ exports.init = (pathConfig,gulp) => {
|
||||
taskName: ['js_build'],
|
||||
taskPath: 'scriptChangePath'
|
||||
}, {
|
||||
watchPath: pathConfig.uglifyBuildPath,
|
||||
taskName: ['uglify_build'],
|
||||
taskPath: 'uglifyChangePath'
|
||||
}, {
|
||||
watchPath: pathConfig.tmodBuildPath,
|
||||
taskName: ['tmodjs_build'],
|
||||
taskPath: 'tmodChangePath'
|
||||
watchPath: pathConfig.artBuildPath,
|
||||
taskName: ['art_build'],
|
||||
taskPath: 'artChangePath'
|
||||
}];
|
||||
|
||||
for (var i = 0; i < watchList.length; i++) {
|
||||
if (watchList[i].taskName[0] == 'uglify_build' || watchList[i].taskName[0] == 'htmlmin_build') continue;
|
||||
//if (watchList[i].taskName[0] == 'uglify_build' || watchList[i].taskName[0] == 'htmlmin_build') continue;
|
||||
|
||||
gulp.watch(watchList[i].watchPath, watchList[i].taskName).on('change', function(event) {
|
||||
//let fileType = util.pathType(event.path);
|
||||
|
||||
Reference in new issue
Block a user