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

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

  1. <small id='Apx7L'></small><noframes id='Apx7L'>

  2. <tfoot id='Apx7L'></tfoot>

      • <bdo id='Apx7L'></bdo><ul id='Apx7L'></ul>

      如何使用 gulp 正確清理項目?

      How to clean a project correctly with gulp?(如何使用 gulp 正確清理項目?)

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

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

                  <tbody id='flWeh'></tbody>

              1. <tfoot id='flWeh'></tfoot>
                本文介紹了如何使用 gulp 正確清理項目?的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

                問題描述

                限時送ChatGPT賬號..

                在 gulp 頁面上有以下示例:

                gulp.task('clean', function(cb) {
                  // You can use multiple globbing patterns as you would with `gulp.src`
                  del(['build'], cb);
                });
                
                gulp.task('scripts', ['clean'], function() {
                  // Minify and copy all JavaScript (except vendor scripts)
                  return gulp.src(paths.scripts)
                    .pipe(coffee())
                    .pipe(uglify())
                    .pipe(concat('all.min.js'))
                    .pipe(gulp.dest('build/js'));
                });
                
                // Copy all static images
                gulp.task('images', ['clean'], function() {
                 return gulp.src(paths.images)
                    // Pass in options to the task
                    .pipe(imagemin({optimizationLevel: 5}))
                    .pipe(gulp.dest('build/img'));
                });
                
                // the task when a file changes
                gulp.task('watch', function() {
                  gulp.watch(paths.scripts, ['scripts']);
                  gulp.watch(paths.images, ['images']);
                });
                
                // The default task (called when you run `gulp` from cli)
                gulp.task('default', ['watch', 'scripts', 'images']);
                

                這很好用.但是 watch 任務存在一個大問題.如果我更改圖像,監視任務會檢測到它并運行 images 任務.這對 clean 任務也有依賴 (gulp.task('images', **['clean']**, function() {)),所以這個也運行.但是我的腳本文件丟失了,因為 scripts 任務沒有再次啟動,并且 clean 任務刪除了所有文件.

                This works quite well. But there is one big problem with the watch task. If I change an image, the watch task detect it and runs the images task. This also has a dependency (gulp.task('images', **['clean']**, function() {) on the clean task, so this runs also. But than my script files are missing because the scripts task did not start again and the clean task deleted all files.

                如何在第一次啟動時運行 clean 任務并保留依賴項?

                How can I just run the clean task on the first startup and keep the dependencies?

                推薦答案

                可以讓watch單獨觸發任務:

                gulp.task('clean', function(cb) {
                  // You can use multiple globbing patterns as you would with `gulp.src`
                  del(['build'], cb);
                });
                
                var scripts = function() {
                  // Minify and copy all JavaScript (except vendor scripts)
                  return gulp.src(paths.scripts)
                    .pipe(coffee())
                    .pipe(uglify())
                    .pipe(concat('all.min.js'))
                    .pipe(gulp.dest('build/js'));
                };
                gulp.task('scripts', ['clean'], scripts);
                gulp.task('scripts-watch', scripts);
                
                // Copy all static images
                var images = function() {
                 return gulp.src(paths.images)
                    // Pass in options to the task
                    .pipe(imagemin({optimizationLevel: 5}))
                    .pipe(gulp.dest('build/img'));
                };
                gulp.task('images', ['clean'], images);
                gulp.task('images-watch', images);
                
                // the task when a file changes
                gulp.task('watch', function() {
                  gulp.watch(paths.scripts, ['scripts-watch']);
                  gulp.watch(paths.images, ['images-watch']);
                });
                
                // The default task (called when you run `gulp` from cli)
                gulp.task('default', ['watch', 'scripts', 'images']);
                

                這篇關于如何使用 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 崩潰)

                  • <bdo id='Wrx3h'></bdo><ul id='Wrx3h'></ul>

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

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

                        <tbody id='Wrx3h'></tbody>
                      <tfoot id='Wrx3h'></tfoot>
                        1. <legend id='Wrx3h'><style id='Wrx3h'><dir id='Wrx3h'><q id='Wrx3h'></q></dir></style></legend>

                          主站蜘蛛池模板: TPE_TPE热塑性弹性体_TPE原料价格_TPE材料厂家-惠州市中塑王塑胶制品公司- 中塑王塑胶制品有限公司 | 江苏齐宝进出口贸易有限公司| 标准件-非标紧固件-不锈钢螺栓-非标不锈钢螺丝-非标螺母厂家-三角牙锁紧自攻-南京宝宇标准件有限公司 | 广州印刷厂_广州彩印厂-广州艺彩印务有限公司 | 播音主持培训-中影人教育播音主持学苑「官网」-中国艺考界的贵族学校 | 卡诺亚轻高定官网_卧室系统_整家定制_定制家居_高端定制_全屋定制加盟_定制家具加盟_定制衣柜加盟 | 灌装封尾机_胶水灌装机_软管灌装封尾机_无锡和博自动化机械制造有限公司 | 华禹护栏|锌钢护栏_阳台护栏_护栏厂家-华禹专注阳台护栏、楼梯栏杆、百叶窗、空调架、基坑护栏、道路护栏等锌钢护栏产品的生产销售。 | 淄博不锈钢,淄博不锈钢管,淄博不锈钢板-山东振远合金科技有限公司 | [品牌官网]贵州遵义双宁口腔连锁_贵州遵义牙科医院哪家好_种植牙_牙齿矫正_原华美口腔 | 洛阳永磁工业大吊扇研发生产-工厂通风降温解决方案提供商-中实洛阳环境科技有限公司 | 地图标注-手机导航电子地图如何标注-房地产商场地图标记【DiTuBiaoZhu.net】 | 水性绝缘漆_凡立水_绝缘漆树脂_环保绝缘漆-深圳维特利环保材料有限公司 | 智能电表|预付费ic卡水电表|nb智能无线远传载波电表-福建百悦信息科技有限公司 | 防勒索软件_数据防泄密_Trellix(原McAfee)核心代理商_Trellix(原Fireeye)售后-广州文智信息科技有限公司 | 光栅尺_Magnescale探规_磁栅尺_笔式位移传感器_苏州德美达 | 北京乾茂兴业科技发展有限公司| 上海办公室装修公司_办公室设计_直营办公装修-羚志悦装 | 华禹护栏|锌钢护栏_阳台护栏_护栏厂家-华禹专注阳台护栏、楼梯栏杆、百叶窗、空调架、基坑护栏、道路护栏等锌钢护栏产品的生产销售。 | 重庆磨床过滤机,重庆纸带过滤机,机床伸缩钣金,重庆机床钣金护罩-重庆达鸿兴精密机械制造有限公司 | 科研ELISA试剂盒,酶联免疫检测试剂盒,昆虫_植物ELISA酶免试剂盒-上海仁捷生物科技有限公司 | 成都办公室装修-办公室设计-写字楼装修设计-厂房装修-四川和信建筑装饰工程有限公司 | 路面机械厂家| 体视显微镜_荧光生物显微镜_显微镜报价-微仪光电生命科学显微镜有限公司 | 石家庄网站建设|石家庄网站制作|石家庄小程序开发|石家庄微信开发|网站建设公司|网站制作公司|微信小程序开发|手机APP开发|软件开发 | 翅片管换热器「型号全」_厂家-淄博鑫科环保 | 中药二氧化硫测定仪,食品二氧化硫测定仪|俊腾百科 | 意大利Frascold/富士豪压缩机_富士豪半封闭压缩机_富士豪活塞压缩机_富士豪螺杆压缩机 | 桁架楼承板-钢筋桁架楼承板-江苏众力达钢筋楼承板厂 | 爱佩恒温恒湿测试箱|高低温实验箱|高低温冲击试验箱|冷热冲击试验箱-您身边的模拟环境试验设备技术专家-合作热线:400-6727-800-广东爱佩试验设备有限公司 | 真丝围巾|真丝丝巾|羊绒围巾|围巾品牌|浙江越缇围巾厂家定制 | 杭州营业执照代办-公司变更价格-许可证办理流程_杭州福道财务管理咨询有限公司 | 深圳善跑体育产业集团有限公司_塑胶跑道_人造草坪_运动木地板 | 生产自动包装秤_颗粒包装秤_肥料包装秤等包装机械-郑州鑫晟重工科技有限公司 | 南昌旅行社_南昌国际旅行社_南昌国旅在线 | 自清洗过滤器,浅层砂过滤器,叠片过滤器厂家-新乡市宇清净化 | 大型冰雕-景区冰雕展制作公司,3D创意设计源头厂家-[赛北冰雕] | 偏心半球阀-电动偏心半球阀-调流调压阀-旋球阀-上欧阀门有限公司 | 汽车整车综合环境舱_军标砂尘_盐雾试验室试验箱-无锡苏南试验设备有限公司 | 志高装潢官网-苏州老房旧房装修改造-二手房装修翻新 | 合肥钣金加工-安徽激光切割加工-机箱机柜加工厂家-合肥通快 |