0
當我用吞氣插件gulp-rev-collector,我已經有一些REV-清單文件,如:一飲而盡-REV集電極不能重命名我的Flash文件(擴展名爲.swf)
"/css/rev-manifest.json", "/js/rev-manifest.json", "/swf/rev-manifest.json"
等
但是,當我運行的下一個任務
return gulp.src([revDir + '/*/.json', htmlSrc])
.pipe(revCollector({
replaceReved: true
}))
.pipe(gulp.dest(htmlDist));
只有CSS/JS /圖像文件的網址已被更改,但不是SWF文件。 我該如何實現這些目標?
這是我的原代碼,我的默認任務是「轉」
var gulp = require('gulp');
var clean = require('gulp-clean');
var rev = require('gulp-rev');
var revReplace = require('gulp-replace');
var replace = require('gulp-replace');
var revCollector = require('gulp-rev-collector');
var minifyHTML = require('gulp-minify-html');
var sequence = require('gulp-sequence');
var through2 = require('through2');
var useref = require('gulp-useref');
var readjson = require('readjson');
var srcDir = "igg_web_src";
var revDir = "igg_web_rev"
var distDir = "igg_web_dist";
var cssSrc = srcDir + "/v1.0/css/*.css";
var jsSrc = srcDir + "/v1.0/js/**/*.js";
var imgSrc = srcDir + "/v1.0/images/*.{jpg,jpeg,png,gif}";
var swfSrc = srcDir + "/flash/**/*.swf";
var htmlSrc = srcDir + '/view/**/*.html';
var cssDist = distDir + "/v1.0/css/";
var jsDist = distDir + "/v1.0/js/";
var imgDist = distDir + "/v1.0/images/";
var swfDist = distDir + "/flash/";
var htmlDist = distDir + '/view/';
gulp.task('clean', function()
{
return gulp.src(distDir + "/*")
.pipe(clean());
});
gulp.task('css', function() {
return gulp.src(cssSrc)
.pipe(rev())
.pipe(gulp.dest(cssDist))
.pipe(rev.manifest())
.pipe(gulp.dest(revDir + "/css"));
});
gulp.task('js', function() {
return gulp.src(jsSrc)
.pipe(rev())
.pipe(gulp.dest(jsDist))
.pipe(rev.manifest())
.pipe(gulp.dest(revDir + "/js"));
});
gulp.task('img', function() {
return gulp.src(imgSrc)
.pipe(rev())
.pipe(gulp.dest(imgDist))
.pipe(rev.manifest())
.pipe(gulp.dest(revDir + "/img"));
});
gulp.task('swf', function() {
return gulp.src(swfSrc)
.pipe(rev())
.pipe(gulp.dest(swfDist))
.pipe(rev.manifest())
.pipe(gulp.dest(revDir + "/swf"));
});
gulp.task('html', function() {
return gulp.src(htmlSrc)
.pipe(rev())
.pipe(gulp.dest(htmlDist))
.pipe(rev.manifest())
.pipe(gulp.dest(revDir + "/html"));
});
gulp.task('copy', function()
{
return gulp.src(srcDir + "/**")
.pipe(gulp.dest(distDir));
});
gulp.task('rev-web', function()
{
return gulp.src([revDir + '/**', htmlSrc])
.pipe(revCollector({
replaceReved: true
}))
.pipe(gulp.dest(htmlDist));
});
gulp.task('rev', sequence('clean', 'copy', 'css','swf', 'js', 'img', 'rev-web'));
請顯示您的gulp文件的較大示例。 gulp-rev-collector依靠gulp-rev來設置manifest.json文件。你需要顯示負責爲你的swfs設置清單的gulp任務。 – Soviut
@Soviut就像一個json地圖,像這樣:{「liveplayer.swf」:「liveplayer-fhdjmskw7sh」} –
請編輯您的原始問題並添加創建清單文件的整個gulp任務。 – Soviut