gulp.src(that.imgFiles, {base:path.normalize(config.root_mediastyle)}) .pipe(imagemin(imageminParamObj)) .pipe(gulpif(!!that.argv.v, hash({ "template": "{name}_" + (that.argv.v == 'RENAME_SELF' && !!that.argv.c ? that.argv.c : "{hash}") + "{ext}?max_age=2592000" }))) .pipe(gulpif(!!that.argv.v && that.argv.v == 'RENAME_LAST', tap(function(file){ //覆盖部分gulp-hash-list插件属性 var srcPath = Tools.formatPath(path.join(path.dirname(file.relative), file.origFilename)); if(renameObj[srcPath]) { file.path = Tools.formatPath(file.path).replace(file.hashFilename.split('?')[0], path.basename(renameObj[srcPath]).split('?')[0]); file.hashFilename = path.basename(renameObj[srcPath]); } }))) .pipe(next(function(fileListArr){ fileList = fileList.concat(fileListArr); })) .pipe(gulpif(!!that.argv.v, save('before-merge-json'))) .pipe(gulpif(!!that.argv.v, hash.manifest('rev-css_'+(new Date().getTime())+'.json'))) .pipe(gulpif(!!that.argv.v, addsrc(path.join(that.cssFilePath, 'rev-css_*.json')))) .pipe(gulpif(!!that.argv.v, merge({ fileName: 'rev-css.json', startObj: renameObj || {} }))) .pipe(gulpif(!!that.argv.v, gulp.dest(that.cssFilePath))) .pipe(gulpif(!!that.argv.v, save.restore('before-merge-json'))) .pipe(Tools.dest(that.server))
file.path = Tools.formatPath(file.path).replace(file.hashFilename.split('?')[0], path.basename(renameObj[srcPath]).split('?')[0]); file.hashFilename = path.basename(renameObj[srcPath]);
file.path = Tools.formatPath(file.path).replace(file.hashFilename.split('?')[0], path.basename(renameObj[srcPath]).split('?')[0]); file.hashFilename = path.basename(renameObj[srcPath]);