Skip to content

Commit 5640494

Browse files
committed
修复合并JS的bug
1 parent 14d6912 commit 5640494

File tree

2 files changed

+25
-7
lines changed

2 files changed

+25
-7
lines changed

package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "WeFlow",
3-
"version": "1.3.2",
4-
"release": "1.3.2",
3+
"version": "1.3.3",
4+
"release": "1.3.3",
55
"description": "A minimal Electron application",
66
"main": "main.js",
77
"scripts": {
@@ -66,7 +66,7 @@
6666
"gulp-sftp": "^0.1.5",
6767
"gulp-tmtsprite": "^0.0.22",
6868
"gulp-uglify": "^1.5.3",
69-
"gulp-usemin": "^0.3.23",
69+
"gulp-useref": "^3.1.2",
7070
"gulp-util": "^3.0.7",
7171
"gulp-webp": "^2.3.0",
7272
"gulp-zip": "^3.2.0",

src/_tasks/dist.js

Lines changed: 22 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ const gulpif = require('gulp-if');
1111
const less = require('gulp-less');
1212
const util = require(path.join(__dirname, './lib/util'));
1313
const uglify = require('gulp-uglify');
14-
const usemin = require('gulp-usemin');
14+
const useref = require('gulp-useref');
1515
const lazyImageCSS = require('gulp-lazyimagecss'); // 自动为图片样式添加 宽/高/background-size 属性
1616
const minifyCSS = require('gulp-cssnano');
1717
const imagemin = require('weflow-imagemin');
@@ -26,6 +26,16 @@ const posthtmlPx2rem = require('posthtml-px2rem');
2626
const RevAll = require('weflow-rev-all'); // reversion
2727
const revDel = require('gulp-rev-delete-original');
2828
const sass = require('gulp-sass');
29+
30+
//svg转换用到的组件
31+
var rename = require('gulp-rename');
32+
var svgmin = require('gulp-svgmin');
33+
var svgInline = require('gulp-svg-inline');
34+
var replace = require('gulp-replace');
35+
var parseSVG = require('./common/parseSVG');
36+
var svgToPng = require('./common/svgToPng');
37+
var svgSymbol = require('gulp-svg-sprite');
38+
2939
const Common = require(path.join(__dirname, '../common'));
3040

3141
let webp = require(path.join(__dirname, './common/webp'));
@@ -82,7 +92,10 @@ function dist(projectPath, log, callback) {
8292
html: path.join(projectPath, './tmp/html'),
8393
js: path.join(projectPath, './tmp/js'),
8494
sprite: path.join(projectPath, './tmp/sprite'),
85-
spriteAll: path.join(projectPath, './tmp/sprite/**/*')
95+
spriteAll: path.join(projectPath, './tmp/sprite/**/*'),
96+
svg: path.join(projectPath, './tmp/img'),
97+
symboltemp: path.join(projectPath, './tmp/symboltemp/'),
98+
symbol: path.join(projectPath, './tmp/symbolsvg')
8699
},
87100
dist: {
88101
dir: path.join(projectPath, './dist'),
@@ -100,6 +113,11 @@ function dist(projectPath, log, callback) {
100113
})
101114
}
102115

116+
// 清除 svg 过渡目录
117+
function delSVG() {
118+
return del([paths.tmp.symboltemp]);
119+
}
120+
103121
function condition(file) {
104122
return path.extname(file.path) === '.png';
105123
}
@@ -112,7 +130,7 @@ function dist(projectPath, log, callback) {
112130
console.log(error.message);
113131
log(error.message);
114132
})
115-
.pipe(lazyImageCSS({imagePath: lazyDir}))
133+
.pipe(lazyImageCSS({imagePath: lazyDir, SVGGracefulDegradation:config.SVGGracefulDegradation}))
116134
.pipe(tmtsprite({margin: 4}))
117135
.pipe(gulpif(condition, gulp.dest(paths.tmp.sprite), gulp.dest(paths.tmp.css)))
118136
.on('data', function () {
@@ -239,7 +257,7 @@ function dist(projectPath, log, callback) {
239257
))
240258
)
241259
.pipe(gulp.dest(paths.tmp.html))
242-
.pipe(usemin())
260+
.pipe(useref())
243261
.pipe(gulp.dest(paths.tmp.html))
244262
.on('end', function () {
245263
console.log('compileHtml success.');

0 commit comments

Comments
 (0)