|
|
@ -14,9 +14,6 @@ var fileinclude = require("gulp-file-include");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var babel = require('gulp-babel');
|
|
|
|
var babel = require('gulp-babel');
|
|
|
|
var webpack = require('webpack-stream');
|
|
|
|
|
|
|
|
var sourceMap = require('gulp-sourcemaps');
|
|
|
|
|
|
|
|
var webpackConfig = require ("./webpack/webpack.config.js");
|
|
|
|
|
|
|
|
// 创建
|
|
|
|
// 创建
|
|
|
|
gulp.task("connect", function () {
|
|
|
|
gulp.task("connect", function () {
|
|
|
|
connect.server({
|
|
|
|
connect.server({
|
|
|
@ -26,6 +23,8 @@ gulp.task("connect", function () {
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
gulp.task("fileinclude", function () {
|
|
|
|
gulp.task("fileinclude", function () {
|
|
|
|
// 适配page中所有文件夹下的所有html,排除src下的tpl文件夹中html
|
|
|
|
// 适配page中所有文件夹下的所有html,排除src下的tpl文件夹中html
|
|
|
|
gulp
|
|
|
|
gulp
|
|
|
@ -79,19 +78,16 @@ gulp.task("watchs", function () {
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 定义JavaScript转译任务
|
|
|
|
gulp.task('script', () => {
|
|
|
|
gulp.task('script', () => {
|
|
|
|
return gulp.src('src/static/js/*.js')
|
|
|
|
return gulp.src('src/static/js/**/*.js') // 指定要转译的JavaScript文件夹
|
|
|
|
.pipe( sourceMap.init() )
|
|
|
|
|
|
|
|
.pipe(babel({
|
|
|
|
.pipe(babel({
|
|
|
|
presets: ['@babel/preset-env']
|
|
|
|
presets: ['@babel/env'] // 使用Babel预设来转译ES6到ES5
|
|
|
|
}))
|
|
|
|
}))
|
|
|
|
.pipe(webpack(webpackConfig))
|
|
|
|
.pipe(gulp.dest('dist/static/js/')); // 输出转译后的文件到dist/static/js/文件夹
|
|
|
|
.pipe(sourceMap.write())
|
|
|
|
|
|
|
|
.pipe(gulp.dest('dist/static/js/'))
|
|
|
|
|
|
|
|
.pipe(connect.reload()); //更新;
|
|
|
|
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
gulp.task("lib", function () {
|
|
|
|
gulp.task("lib", function () {
|
|
|
|
return gulp
|
|
|
|
return gulp
|
|
|
|
.src("src/static/lib/*.js")
|
|
|
|
.src("src/static/lib/*.js")
|
|
|
|