久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

<legend id='JToZH'><style id='JToZH'><dir id='JToZH'><q id='JToZH'></q></dir></style></legend>
  • <small id='JToZH'></small><noframes id='JToZH'>

    <i id='JToZH'><tr id='JToZH'><dt id='JToZH'><q id='JToZH'><span id='JToZH'><b id='JToZH'><form id='JToZH'><ins id='JToZH'></ins><ul id='JToZH'></ul><sub id='JToZH'></sub></form><legend id='JToZH'></legend><bdo id='JToZH'><pre id='JToZH'><center id='JToZH'></center></pre></bdo></b><th id='JToZH'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='JToZH'><tfoot id='JToZH'></tfoot><dl id='JToZH'><fieldset id='JToZH'></fieldset></dl></div>

    <tfoot id='JToZH'></tfoot>

        <bdo id='JToZH'></bdo><ul id='JToZH'></ul>

        gulp:自動為請求添加版本號以防止瀏覽器緩存

        gulp: Automatically add version number to request for preventing browser cache(gulp:自動為請求添加版本號以防止瀏覽器緩存)
        <i id='ZNV31'><tr id='ZNV31'><dt id='ZNV31'><q id='ZNV31'><span id='ZNV31'><b id='ZNV31'><form id='ZNV31'><ins id='ZNV31'></ins><ul id='ZNV31'></ul><sub id='ZNV31'></sub></form><legend id='ZNV31'></legend><bdo id='ZNV31'><pre id='ZNV31'><center id='ZNV31'></center></pre></bdo></b><th id='ZNV31'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='ZNV31'><tfoot id='ZNV31'></tfoot><dl id='ZNV31'><fieldset id='ZNV31'></fieldset></dl></div>

              <tfoot id='ZNV31'></tfoot>

              • <bdo id='ZNV31'></bdo><ul id='ZNV31'></ul>
                  <tbody id='ZNV31'></tbody>
                <legend id='ZNV31'><style id='ZNV31'><dir id='ZNV31'><q id='ZNV31'></q></dir></style></legend>

                <small id='ZNV31'></small><noframes id='ZNV31'>

                  本文介紹了gulp:自動為請求添加版本號以防止瀏覽器緩存的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學(xué)習(xí)吧!

                  問題描述

                  限時送ChatGPT賬號..

                  我通過在服務(wù)器上使用 gulp 構(gòu)建源文件來部署我的項目.為防止出現(xiàn)緩存問題,最佳做法是為請求 url 添加一個唯一編號,請參閱:防止瀏覽器在 Web 應(yīng)用程序升級時緩存;

                  I deploy my project by building source files with gulp right on the server. To prevent caching issues, the best practice could be adding a unique number to request url, see: Preventing browser caching on web application upgrades;

                  在 npm 存儲庫中,我找不到自動向請求添加版本號的工具.我在問是否有人以前發(fā)明過這樣的工具.

                  In npm repositories, I couldn't find a tool for automatically adding version number to request. I'm asking if someone has invented such tool before.

                  可能的實(shí)現(xiàn)如下:

                  我在 src/ 文件夾中有一個文件 index.html,帶有以下腳本標(biāo)簽

                  I have a file index.html in src/ folder, with following script tag

                   <script src="js/app.js<!-- %nocache% -->"></script>
                  

                  在構(gòu)建過程中,它被復(fù)制到 dist/ 文件夾,并且注釋被替換為自增號

                  During build it is copied to dist/ folder, and comment is replaced by autoincrement number

                   <script src="js/app.js?t=1234"></script>
                  

                  推薦答案

                  你可以使用 gulp-version-number 為此.它可以通過將參數(shù)附加到 URL 來將版本號添加到 HTML 文檔中的鏈接腳本、樣式表和其他文件.例如:

                  You can use gulp-version-number for this. It can add version numbers to linked scripts, stylesheets, and other files in you HTML documents, by appending an argument to the URLs. For example:

                  <link rel="stylesheet" href="main.css">
                  

                  變成:

                  <link rel="stylesheet" href="main.css?v=474dee2efac59e2dcac7bf6c37365ed0">
                  

                  您甚至不必指定占位符,就像您在示例實(shí)現(xiàn)中展示的那樣.而且是可配置的.

                  You don't even have to specify a placeholder, like you showed in your example implementation. And it's configurable.

                  示例用法:

                  const $ = gulpLoadPlugins();
                  const versionConfig = {
                    'value': '%MDS%',
                    'append': {
                      'key': 'v',
                      'to': ['css', 'js'],
                    },
                  };
                  
                  gulp.task('html', () => {
                    return gulp.src('src/**/*.html')
                      .pipe($.htmlmin({collapseWhitespace: true}))
                      .pipe($.versionNumber(versionConfig))
                      .pipe(gulp.dest('docroot'));
                  });
                  

                  這篇關(guān)于gulp:自動為請求添加版本號以防止瀏覽器緩存的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網(wǎng)!

                  【網(wǎng)站聲明】本站部分內(nèi)容來源于互聯(lián)網(wǎng),旨在幫助大家更快的解決問題,如果有圖片或者內(nèi)容侵犯了您的權(quán)益,請聯(lián)系我們刪除處理,感謝您的支持!

                  相關(guān)文檔推薦

                  Browserify, Babel 6, Gulp - Unexpected token on spread operator(Browserify,Babel 6,Gulp - 傳播運(yùn)算符上的意外令牌)
                  Is it possible to pass a flag to Gulp to have it run tasks in different ways?(是否可以將標(biāo)志傳遞給 Gulp 以使其以不同的方式運(yùn)行任務(wù)?)
                  Why do we need to install gulp globally and locally?(為什么我們需要在全局和本地安裝 gulp?)
                  How to run Gulp tasks sequentially one after the other(如何一個接一個地依次運(yùn)行 Gulp 任務(wù))
                  Visual Studio 2015 crashes when opening Javascript files(打開 Javascript 文件時 Visual Studio 2015 崩潰)
                  Detect FLASH plugin crashes(檢測 FLASH 插件崩潰)

                  • <small id='eZndQ'></small><noframes id='eZndQ'>

                        <tbody id='eZndQ'></tbody>

                          <bdo id='eZndQ'></bdo><ul id='eZndQ'></ul>
                        • <legend id='eZndQ'><style id='eZndQ'><dir id='eZndQ'><q id='eZndQ'></q></dir></style></legend>

                          • <i id='eZndQ'><tr id='eZndQ'><dt id='eZndQ'><q id='eZndQ'><span id='eZndQ'><b id='eZndQ'><form id='eZndQ'><ins id='eZndQ'></ins><ul id='eZndQ'></ul><sub id='eZndQ'></sub></form><legend id='eZndQ'></legend><bdo id='eZndQ'><pre id='eZndQ'><center id='eZndQ'></center></pre></bdo></b><th id='eZndQ'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='eZndQ'><tfoot id='eZndQ'></tfoot><dl id='eZndQ'><fieldset id='eZndQ'></fieldset></dl></div>
                            <tfoot id='eZndQ'></tfoot>
                          • 主站蜘蛛池模板: 二区av| 精品欧美一区二区在线观看欧美熟 | 久久中文字幕一区 | 日本特黄a级高清免费大片 成年人黄色小视频 | 欧美亚洲日本 | 免费一级欧美在线观看视频 | 日韩免费一区二区 | 九九视频在线观看视频6 | 不卡在线视频 | 色欧美综合 | 亚洲 成人 在线 | 国产精品一区二区无线 | 日韩精品视频在线观看一区二区三区 | 国产在线精品一区二区三区 | 久久福利电影 | 欧美日韩在线精品 | 国产一区三区在线 | 麻豆一区二区三区精品视频 | 青青草av在线播放 | 国产欧美一区二区三区日本久久久 | 成人在线观看网址 | 本地毛片| 国产视频精品视频 | 欧美色性| 日韩精品视频中文字幕 | 国产精品久久久久久久久久免费看 | 四季久久免费一区二区三区四区 | 91久久精品国产 | 福利国产 | 欧美精品欧美精品系列 | 免费精品| 99re在线免费视频 | 国产美女在线播放 | 久久综合九色综合欧美狠狠 | 福利一区二区在线 | 亚洲区一区二区 | 精品国产一区二区三区四区在线 | 亚洲精品在线视频 | 久久久久久久久久久爱 | 日韩在线一区二区三区 | 国产精品夜夜夜一区二区三区尤 |