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

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

    <small id='2oCTT'></small><noframes id='2oCTT'>

    <legend id='2oCTT'><style id='2oCTT'><dir id='2oCTT'><q id='2oCTT'></q></dir></style></legend>
    1. 如何從 GULP 將變量值注入 JS 文件

      How to inject variable value into JS file from GULP(如何從 GULP 將變量值注入 JS 文件)

    2. <small id='5GY7J'></small><noframes id='5GY7J'>

        • <legend id='5GY7J'><style id='5GY7J'><dir id='5GY7J'><q id='5GY7J'></q></dir></style></legend><tfoot id='5GY7J'></tfoot>
            <bdo id='5GY7J'></bdo><ul id='5GY7J'></ul>
            1. <i id='5GY7J'><tr id='5GY7J'><dt id='5GY7J'><q id='5GY7J'><span id='5GY7J'><b id='5GY7J'><form id='5GY7J'><ins id='5GY7J'></ins><ul id='5GY7J'></ul><sub id='5GY7J'></sub></form><legend id='5GY7J'></legend><bdo id='5GY7J'><pre id='5GY7J'><center id='5GY7J'></center></pre></bdo></b><th id='5GY7J'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='5GY7J'><tfoot id='5GY7J'></tfoot><dl id='5GY7J'><fieldset id='5GY7J'></fieldset></dl></div>

                <tbody id='5GY7J'></tbody>
                本文介紹了如何從 GULP 將變量值注入 JS 文件的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

                問題描述

                限時送ChatGPT賬號..

                希望這是一個快速的問題.

                Hopefully this is a quick question.

                我要做的是在使用 GULP 構建文件時將時間戳添加到 JS 文件中的 Javascript 對象中.基本上,在file.js"中,我有一個對象,我希望 object.timeStamp 等于 GULP 構建的時間.

                What I'm trying to do is to add a timestamp into a Javascript object in a JS file while the file is being built with GULP. Basically, in "file.js", I have an object where I would like to have object.timeStamp that equals the time of the GULP build.

                我目前正在使用 gulp-header 將時間戳添加到文件頂部,但有人要求我將時間戳添加到對象中的屬性中.

                I am currently adding a timestamp to the top of the file using gulp-header, but I have been asked to add the timestamp to a property in the object.

                我的想法是從 GULP 中注入值,但目前我發現的所有注入插件都是用于將一個文件的內容注入目標文件.

                My thought was to inject the value from GULP, but all of the injection plugins I have found so far are for injecting contents of one file into the target file.

                任何幫助將不勝感激.

                推薦答案

                你在使用任何類型的模塊嗎?ES6 模塊、AMD、CommonJS、...?

                Are you using any kind of modules? ES6 modules, AMD, CommonJS, ...?

                如果是這樣,您可以使用 Gulp生成一個 config 模塊,您可以在其中注入任何您想要的變量.它看起來像這樣:

                If so, you can generate a config module with Gulp where you can inject any variable you want. It would look something like this:

                config.tmpl.js

                module.exports = <%= config %>
                

                配置 gulp 任務

                var gulp = require('gulp');
                var template = require('gulp-template');
                var rename = require('gulp-rename');
                
                gulp.task('config', function() {
                  return gulp.src('path/to/config.tmpl.js')
                    .pipe(template({config: JSON.stringify({
                      timeStamp: new Date()
                    })}))
                    .pipe(rename('config.js'))
                    .pipe(gulp.dest('path/to/config.js'));
                });
                

                最后,在您的 JS 文件中

                var config = require('path/to/config.js');
                
                var object = {
                  timeStamp: config.timeStamp
                }
                

                這篇關于如何從 GULP 將變量值注入 JS 文件的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持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 任務)
                Stylesheet not loaded because of MIME-type(由于 MIME 類型而未加載樣式表)
                Visual Studio 2015 crashes when opening Javascript files(打開 Javascript 文件時 Visual Studio 2015 崩潰)
                  <legend id='FF03S'><style id='FF03S'><dir id='FF03S'><q id='FF03S'></q></dir></style></legend>

                    <bdo id='FF03S'></bdo><ul id='FF03S'></ul>
                  • <small id='FF03S'></small><noframes id='FF03S'>

                        <i id='FF03S'><tr id='FF03S'><dt id='FF03S'><q id='FF03S'><span id='FF03S'><b id='FF03S'><form id='FF03S'><ins id='FF03S'></ins><ul id='FF03S'></ul><sub id='FF03S'></sub></form><legend id='FF03S'></legend><bdo id='FF03S'><pre id='FF03S'><center id='FF03S'></center></pre></bdo></b><th id='FF03S'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='FF03S'><tfoot id='FF03S'></tfoot><dl id='FF03S'><fieldset id='FF03S'></fieldset></dl></div>
                        <tfoot id='FF03S'></tfoot>
                          <tbody id='FF03S'></tbody>
                        1. 主站蜘蛛池模板: 日韩美香港a一级毛片免费 国产综合av | 黄免费观看 | 国产探花在线精品一区二区 | 国产二区精品视频 | 日本欧美在线视频 | 亚洲一区二区三区四区五区午夜 | 男人天堂99 | 91精品国产乱码麻豆白嫩 | 精品国产欧美一区二区三区成人 | 国产一级特黄视频 | 国产美女黄色 | 成人精品鲁一区一区二区 | 99久久婷婷 | 完全免费在线视频 | 成人免费淫片aa视频免费 | 91精品国产91久久综合桃花 | 日韩午夜激情 | 亚洲人成人一区二区在线观看 | 欧美aaaaaa| 精品中文字幕久久 | 国产精品嫩草影院精东 | 视频一区在线 | 日韩一区二区在线视频 | 污污的网站在线观看 | 亚洲综合视频 | 成人h免费观看视频 | 午夜丁香视频在线观看 | 亚洲综合精品 | 免费中文字幕日韩欧美 | 国产欧美精品一区二区三区 | 国产乱性| 国产精品国产成人国产三级 | 成人在线精品视频 | 国产日韩欧美综合 | 亚洲精品一区二三区不卡 | 在线免费观看视频你懂的 | 97精品超碰一区二区三区 | 日韩在线看片 | 一区二区三区免费 | 欧美日韩视频网站 | 亚洲精品乱码久久久久久蜜桃91 |