<ruby id="bdb3f"></ruby>

    <p id="bdb3f"><cite id="bdb3f"></cite></p>

      <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
        <p id="bdb3f"><cite id="bdb3f"></cite></p>

          <pre id="bdb3f"></pre>
          <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

          <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
          <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

          <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                <ruby id="bdb3f"></ruby>

                合規國際互聯網加速 OSASE為企業客戶提供高速穩定SD-WAN國際加速解決方案。 廣告
                # 刪除文件和文件夾 你也許會想要在編譯文件之前刪除一些文件。由于刪除文件和文件內容并沒有太大關系,所以,我們沒必要去用一個 gulp 插件。最好的一個選擇就是使用一個原生的 node 模塊。 因為 [`del`](https://github.com/sindresorhus/del) 模塊支持多個文件以及 [globbing](https://github.com/sindresorhus/multimatch#globbing-patterns),因此,在這個例子中,我們將使用它來刪除文件: ``` $ npm install --save-dev gulp del ``` 假想有如下的文件結構: ``` . ├── dist │ ├── report.csv │ ├── desktop │ └── mobile │ ├── app.js │ ├── deploy.json │ └── index.html └── src ``` 在 gulpfile 中,我們希望在運行我們的編譯任務之前,將 `mobile` 文件的內容先清理掉: ``` var gulp = require('gulp'); var del = require('del'); gulp.task('clean:mobile', function (cb) { del([ 'dist/report.csv', // 這里我們使用一個通配模式來匹配 `mobile` 文件夾中的所有東西 'dist/mobile/**/*', // 我們不希望刪掉這個文件,所以我們取反這個匹配模式 '!dist/mobile/deploy.json' ], cb); }); gulp.task('default', ['clean:mobile']); ``` ## 在管道中刪除文件 你可能需要在管道中將一些處理過的文件刪除掉。 我們使用 [vinyl-paths](https://github.com/sindresorhus/vinyl-paths) 模塊來簡單地獲取 stream 中每個文件的路徑,然后傳給 `del` 方法。 ``` $ npm install --save-dev gulp del vinyl-paths ``` 假想有如下的文件結構: ``` . ├── tmp │ ├── rainbow.js │ └── unicorn.js └── dist ``` ``` var gulp = require('gulp'); var stripDebug = require('gulp-strip-debug'); // 僅用于本例做演示 var del = require('del'); var vinylPaths = require('vinyl-paths'); gulp.task('clean:tmp', function () { return gulp.src('tmp/*') .pipe(stripDebug()) .pipe(gulp.dest('dist')) .pipe(vinylPaths(del)); }); gulp.task('default', ['clean:tmp']); ``` 只有在已經使用了其他的插件之后才需要這樣做,否則,請直接使用 `gulp.src` 來代替。
                  <ruby id="bdb3f"></ruby>

                  <p id="bdb3f"><cite id="bdb3f"></cite></p>

                    <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
                      <p id="bdb3f"><cite id="bdb3f"></cite></p>

                        <pre id="bdb3f"></pre>
                        <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

                        <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
                        <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

                        <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                              <ruby id="bdb3f"></ruby>

                              哎呀哎呀视频在线观看