Skip to content

Commit 523ba5b

Browse files
committed
[FIX] Package building error.
1 parent 0feb52c commit 523ba5b

File tree

3 files changed

+15
-4
lines changed

3 files changed

+15
-4
lines changed

.gitignore

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
csp/.idea
22
.idea
33
node_modules
4-
build
4+
build
5+
package-lock.json

gulpfile.js

+12-2
Original file line numberDiff line numberDiff line change
@@ -26,13 +26,23 @@ gulp.task('lint', function () {
2626
});
2727

2828
gulp.task('minify:js', function () {
29+
var assets = useref.assets();
2930
return gulp.src('./csp/index.html')
30-
.pipe(useref())
31+
.pipe(assets)
3132
.pipe(gulpIf("*.js",replace('"{{package.json.version}}"', '"' + p.version + '"')))
3233
.pipe(gulpIf("*.js",traceur()))
3334
.pipe(gulpIf("*.js",uglify()))
3435
.pipe(gulpIf("*.html",htmlmin({empty: false})))
35-
.pipe(gulp.dest('build'));
36+
.pipe(assets.restore())
37+
.pipe(useref())
38+
//.pipe(gulp.dest('build'))
39+
.pipe(through.obj(function (chunk, enc, cb) {
40+
if (!fs.existsSync("./build")) fs.mkdirSync("./build");
41+
if (!fs.existsSync("./build/src")) fs.mkdirSync("./build/src");
42+
fs.writeFileSync("./build/"+chunk.relative, chunk.contents);
43+
cb(null, chunk);
44+
}))
45+
.pipe(debug({title: "after save"}));
3646
});
3747

3848
gulp.task('minify:css', function () {

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
"gulp-replace": "^0.6.1",
1818
"gulp-traceur-compiler": "^1.1.4",
1919
"gulp-uglify": "^3.0.0",
20-
"gulp-useref": "^3.1.2",
20+
"gulp-useref": "^1.3.0",
2121
"jshint": "^2.9.5",
2222
"through2": "^2.0.3"
2323
},

0 commit comments

Comments
 (0)