当前位置:网站首页>Getting Started 11 Automatically add version numbers
Getting Started 11 Automatically add version numbers
2022-08-05 06:08:00 【dongsdh】
Basic usage
const { src, dest, series, watch, parallel } = require("gulp");const rev = require("gulp-rev");function clean(cb) {console.log("clean up");cb();}function js(cb) {console.log("processing js");src("./src/js/*.js").pipe(rev()).pipe(dest("./dist/js"));cb();}function css(cb) {console.log("processing css");cb();}const Run = series(clean, js, css);exports.default = Run;
Generate with random version number
Every time html is introduced into js, the version number must be modified, which is unscientific and modified
Generate rev-manifest.json file
const { src, dest, series, watch, parallel } = require("gulp");const rev = require("gulp-rev");function clean(cb) {console.log("clean up");cb();}function js(cb) {console.log("processing js");src("./src/js/*.js").pipe(rev()).pipe(dest("./dist/js")).pipe(rev.manifest()).pipe(dest('./dist/rev/js'));cb();}function css(cb) {console.log("processing css");cb();}const Run = series(clean, js, css);exports.default = Run;
After generating the rev-manifest.json file, html accesses the content of the generated version number and the problems encountered
Original html
After html parsing
-----------------------------------------------------------------------------------------------------------------------------
边栏推荐
猜你喜欢
随机推荐
小度 小度 在呢!
一个小时教你如何掌握ts基础
Remembering my first CCF-A conference paper | After six rejections, my paper is finally accepted, yay!
每日一题-三数之和-0716(2)
【UiPath2022+C#】UiPath If条件语句
栈的应用——力扣 20.有效的括号
C语言查看大小端(纯代码)
D39_欧拉角与四元数
成功的独立开发者应对失败&冒名顶替综
LeetCode刷题之第61题
教你如何封装功能组件和页面组件
spark源码-任务提交流程之-5-CoarseGrainedExecutorBackend
spark源码-任务提交流程之-4-container中启动executor
游戏引擎除了开发游戏还能做什么?
链表章6道easy总结(leetcode)
云游戏未来展望
D46_给刚体施加的力
“元宇宙”是个啥?都有哪些大招?
腾讯云消息队列CMQ
入门文档10 资源映射