LoginSignup
3
2

More than 3 years have passed since last update.

【gulp】タスクの簡単読解

Last updated at Posted at 2019-04-22

Gulpのタスクの書き方は「そういうもんなのね」と覚える。

タスクの宣言

gulp.task('task-name', () => {
    // 処理
};

ファイルの読み込み

gulp src('path')

書き出し

gulp.dest('path')

つなげる

gulpの処理は、メソッドを繋げてかく。(メソッドチェーン
このとき pipe()という関数で、その後の処理を囲うべし。

まとめ

gulp.task('copy', () => {
    gulp.src('./src/index.html')
      .pipe(gulp.dest('./www/'));
});

このタスクはsrc()で読み込んで、pipe()からのー、dest()で書き出しただけのタスク。
つまり、src/www/へコピーするだけのタスク。基本はこのsrcとdestの間に、コンパイルとかの処理が入る。

3
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
3
2