mirror of
https://github.com/caojiezi2003/clock-shop.git
synced 2024-11-10 05:29:46 +00:00
replace js file
replace js file
This commit is contained in:
parent
de58aac3be
commit
b6db687b94
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -1,15 +1,24 @@
|
|||||||
var map = require('map-stream');
|
var map = require('map-stream');
|
||||||
var vfs = require('vinyl-fs');
|
var vfs = require('vinyl-fs');
|
||||||
|
|
||||||
var replace = function (file, cb) {
|
vfs.src(['./dist/css/*.css'])
|
||||||
|
.pipe(map(function (file, cb) {
|
||||||
var content = file.contents;
|
var content = file.contents;
|
||||||
content = content.toString('utf8');
|
content = content.toString('utf8');
|
||||||
content = content.replace('/banner.jpg','../banner.jpg').replace('/font/','../font/')
|
content = content.replace('/banner.jpg', '../banner.jpg').replace('/font/', '../font/')
|
||||||
file.contents = Buffer.from(content);
|
file.contents = Buffer.from(content);
|
||||||
|
|
||||||
cb(null, file);
|
cb(null, file);
|
||||||
};
|
}))
|
||||||
|
|
||||||
vfs.src(['./dist/css/*.css'])
|
|
||||||
.pipe(map(replace))
|
|
||||||
.pipe(vfs.dest('./dist/css/'));
|
.pipe(vfs.dest('./dist/css/'));
|
||||||
|
|
||||||
|
vfs.src(['./dist/js/*.js'])
|
||||||
|
.pipe(map(function (file, cb) {
|
||||||
|
var content = file.contents;
|
||||||
|
content = content.toString('utf8');
|
||||||
|
content = content.replace('/data.yaml', '../data.yaml');
|
||||||
|
file.contents = Buffer.from(content);
|
||||||
|
|
||||||
|
cb(null, file);
|
||||||
|
}))
|
||||||
|
.pipe(vfs.dest('./dist/js/'));
|
Loading…
Reference in New Issue
Block a user