久久久久久久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:自動為請求添加版本號以防止瀏覽器緩存的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

                  問題描述

                  限時送ChatGPT賬號..

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

                  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 存儲庫中,我找不到自動向請求添加版本號的工具.我在問是否有人以前發明過這樣的工具.

                  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.

                  可能的實現如下:

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

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

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

                  在構建過程中,它被復制到 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 為此.它可以通過將參數附加到 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">
                  

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

                  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'));
                  });
                  

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

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

                  相關文檔推薦

                  Browserify, Babel 6, Gulp - Unexpected token on spread operator(Browserify,Babel 6,Gulp - 傳播運算符上的意外令牌)
                  Is it possible to pass a flag to Gulp to have it run tasks in different ways?(是否可以將標志傳遞給 Gulp 以使其以不同的方式運行任務?)
                  Why do we need to install gulp globally and locally?(為什么我們需要在全局和本地安裝 gulp?)
                  How to run Gulp tasks sequentially one after the other(如何一個接一個地依次運行 Gulp 任務)
                  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>
                          • 主站蜘蛛池模板: 欧美成人一级 | 国产欧美日韩综合精品 | 一级黄色录像片 | 亚洲美女一区 | 欧美日韩精品久久久免费观看 | 在线欧美| 四虎入口| 涩涩视频免费看 | 欧美成人精品欧美一级私黄 | 久久精品视频网 | 麻豆亚洲一区 | 国产欧美一区二区三区视频在线观看 | 日韩视频中文字幕 | 国产理论在线观看 | 黄色在线免费看 | 久久久久久久九九九九 | 成人做受黄大片 | 爱爱免费网站 | 日韩精品视频网站 | 成人激情视频 | 91精品亚洲 | 毛片网站免费 | 福利片在线 | 午夜性影院 | 欧美精品www | 激情四射网站 | 欧美激情xxx| 久草网在线观看 | 日本少妇高潮达到高潮 | 三上悠亚一区二区 | 性色av一区 | 久久福利视频导航 | 欧美日韩国产在线观看 | 欧美成人精品一区二区 | 国产午夜三级 | 国产女人水真多18毛片18精品 | 久久久黄色片 | 国产精品美女 | 国产成人a亚洲精品 | 黄色网在线 | 国产理论片 |