pbootcms网站模板|日韩1区2区|织梦模板||网站源码|日韩1区2区|jquery建站特效-html5模板网

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

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

    <tfoot id='jnReu'></tfoot>

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

        <legend id='jnReu'><style id='jnReu'><dir id='jnReu'><q id='jnReu'></q></dir></style></legend>
      2. 在 Gulp 中使用變量作為目標文件名?

        Using variables in Gulp for the destination file name?(在 Gulp 中使用變量作為目標文件名?)
          <i id='orTPo'><tr id='orTPo'><dt id='orTPo'><q id='orTPo'><span id='orTPo'><b id='orTPo'><form id='orTPo'><ins id='orTPo'></ins><ul id='orTPo'></ul><sub id='orTPo'></sub></form><legend id='orTPo'></legend><bdo id='orTPo'><pre id='orTPo'><center id='orTPo'></center></pre></bdo></b><th id='orTPo'></th></span></q></dt></tr></i><div class="hsgbs8s" id='orTPo'><tfoot id='orTPo'></tfoot><dl id='orTPo'><fieldset id='orTPo'></fieldset></dl></div>
          <legend id='orTPo'><style id='orTPo'><dir id='orTPo'><q id='orTPo'></q></dir></style></legend>

            <tbody id='orTPo'></tbody>
          <tfoot id='orTPo'></tfoot>

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

          • <bdo id='orTPo'></bdo><ul id='orTPo'></ul>
                  本文介紹了在 Gulp 中使用變量作為目標文件名?的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

                  問題描述

                  限時送ChatGPT賬號..

                  我是 gulp 的新手,我想知道我想要實現的目標是實際的還是可能的.

                  I am new to gulp and I am wondering if what I want to achieve is practical or possible.

                  我的項目結構:

                  root
                  |
                  components
                  |   |
                  |   component_1
                  |   |   styles.scss
                  |   |   actions.js
                  |   |   template.html
                  |   |   ...
                  |   component_2
                  |   |   styles.scss
                  |   |   template.html
                  |   |   ...
                  |
                  public
                      |
                      assets
                           |
                           css (dest)
                           |    component_1.css
                           |    component_2.css
                           |    ...
                           js (dest)
                  

                  現在我想要的是 Gulp 將編譯后的 css 文件存儲在 public/assets 的相應 css 文件夾中,但使用它找到 scss 文件的文件夾的名稱.那可能嗎?我需要將它傳送到插件嗎?謝謝!PS我確實意識到我可以通過重命名scss來實現這一點,但這是我想避免的.

                  Now what I want is that Gulp stores the compiled css files in the according css folder in public/assets but uses the name of folder where it found the scss file. Is that possible? Do I need to pipe that to a plugin? Thanks! PS i do realize I could achieve that by just renaming the scss, but that's what I'd like to avoid.

                  推薦答案

                  這不會太難,這取決于你需要多少動態.Gulp 是純 JS,因此您可以非常輕松地編寫自己的函數.您可以使用 gulp-rename 插件 重命名部分或全部文件名保存之前.

                  It wouldn't be too hard, depending on how much you need it to be dynamic. Gulp is pure JS, so you can very easily write your own functions. you can use the gulp-rename plugin to rename part or all of the file name before saving.

                  這里有一個粗略的想法可以幫助您入門:

                  Here's a rough idea to get you started:

                  var rename = require('gulp-rename'),
                      path = require('path'),
                      glob = require('glob'); // npm i --save-dev glob    
                  
                  var components = glob.sync('components/*').map(function(componentDir) {
                          return path.basename(componentDir);
                      });
                  
                  components.forEach(function(name) {
                      gulp.task(name+'-style', function() {
                          return gulp.src('components/'+name+'/styles.scss')
                              .pipe(sass()) // etc
                              .pipe(rename(name + '.css'))
                              .pipe(gulp.dest('public/assets/css'))
                      });
                  
                      gulp.task(name+'-js', function() {
                          // similar idea for JS files
                      });
                  
                      gulp.task(name+'-build', [name+'-style', name+'-js']);
                  });
                  
                  // build all components
                  gulp.task('build-components', components.map(function(name){ return name+'-build'; }));
                  

                  現在您將為每個組件創建名為 component_1-buildcomponent_1-stylecomponent_1-js 等的任務.

                  Now you'll have tasks named component_1-build, component_1-style, component_1-js, etc, for each component.

                  您還有一個可以構建所有組件的任務.

                  You also have a task that can build all components.

                  這篇關于在 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 任務)
                  Stylesheet not loaded because of MIME-type(由于 MIME 類型而未加載樣式表)
                  Visual Studio 2015 crashes when opening Javascript files(打開 Javascript 文件時 Visual Studio 2015 崩潰)

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

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

                              <tbody id='DOte0'></tbody>

                            主站蜘蛛池模板: 亚洲工业智能制造领域专业门户网站 - 亚洲自动化与机器人网 | 专业广州网站建设,微信小程序开发,一物一码和NFC应用开发、物联网、外贸商城、定制系统和APP开发【致茂网络】 | EPDM密封胶条-EPDM密封垫片-EPDM生产厂家| 除甲醛公司-甲醛检测治理-杭州创绿家环保科技有限公司-室内空气净化十大品牌 | 同步带轮_同步带_同步轮_iHF合发齿轮厂家-深圳市合发齿轮机械有限公司 | 鄂泉泵业官网|(杭州、上海、全国畅销)大流量防汛排涝泵-LW立式排污泵 | 智能电表|预付费ic卡水电表|nb智能无线远传载波电表-福建百悦信息科技有限公司 | 防水套管厂家-柔性防水套管-不锈钢|刚性防水套管-天翔管道 | 低气压试验箱_高低温低气压试验箱_低气压实验箱 |林频试验设备品牌 | 天津货架厂_穿梭车货架_重型仓储货架_阁楼货架定制-天津钢力仓储货架生产厂家_天津钢力智能仓储装备 | 天津试验仪器-电液伺服万能材料试验机,恒温恒湿标准养护箱,水泥恒应力压力试验机-天津鑫高伟业科技有限公司 | 水质传感器_水质监测站_雨量监测站_水文监测站-山东水境传感科技有限公司 | 模型公司_模型制作_沙盘模型报价-中国模型网 | 加盟店-品牌招商加盟-创业项目商机平台| 上海律师咨询_上海法律在线咨询免费_找对口律师上策法网-策法网 广东高华家具-公寓床|学生宿舍双层铁床厂家【质保十年】 | 电缆故障测试仪_电缆故障定位仪_探测仪_检测仪器_陕西意联电气厂家 | 北京银联移动POS机办理_收银POS机_智能pos机_刷卡机_收银系统_个人POS机-谷骐科技【官网】 | 六维力传感器_三维力传感器_二维力传感器-南京神源生智能科技有限公司 | 天空彩票天下彩,天空彩天空彩票免费资料,天空彩票与你同行开奖,天下彩正版资料大全 | 学考网学历中心| 自动螺旋上料机厂家价格-斗式提升机定制-螺杆绞龙输送机-杰凯上料机 | Brotu | 关注AI,Web3.0,VR/AR,GPT,元宇宙区块链数字产业 | 全温恒温摇床-水浴气浴恒温摇床-光照恒温培养摇床-常州金坛精达仪器制造有限公司 | 胶原检测试剂盒,弹性蛋白检测试剂盒,类克ELISA试剂盒,阿达木单抗ELISA试剂盒-北京群晓科苑生物技术有限公司 | 耐压仪-高压耐压仪|徐吉电气 | 冷却塔风机厂家_静音冷却塔风机_冷却塔电机维修更换维修-广东特菱节能空调设备有限公司 | 石家庄律师_石家庄刑事辩护律师_石家庄取保候审-河北万垚律师事务所 | 水平垂直燃烧试验仪-灼热丝试验仪-漏电起痕试验仪-针焰试验仪-塑料材料燃烧检测设备-IP防水试验机 | 会议会展活动拍摄_年会庆典演出跟拍_摄影摄像直播-艾木传媒 | 阴离子_阳离子聚丙烯酰胺厂家_聚合氯化铝价格_水处理絮凝剂_巩义市江源净水材料有限公司 | 基本型顶空进样器-全自动热脱附解吸仪价格-AutoHS全模式-成都科林分析技术有限公司 | 世界箱包品牌十大排名,女包小众轻奢品牌推荐200元左右,男包十大奢侈品牌排行榜双肩,学生拉杆箱什么品牌好质量好 - Gouwu3.com | 游泳池设计|设备|配件|药品|吸污机-东莞市太平洋康体设施有限公司 | 安徽净化工程设计_无尘净化车间工程_合肥净化实验室_安徽创世环境科技有限公司 | 柴油发电机组_柴油发电机_发电机组价格-江苏凯晨电力设备有限公司 | ge超声波测厚仪-电动涂膜机-电动划格仪-上海洪富 | 中式装修设计_全屋定制家具_实木仿古门窗花格厂家-喜迎门 | 箱式破碎机_移动方箱式破碎机/价格/厂家_【华盛铭重工】 | 杜甫仪器官网|实验室平行反应器|升降水浴锅|台式低温循环泵 | 睿婕轻钢别墅_钢结构别墅_厂家设计施工报价 | 淋巴细胞分离液_口腔医疗器材-精欣华医疗器械(无锡)有限公司 |