Skip to content

Instantly share code, notes, and snippets.

@chiehwen
Created August 1, 2014 08:49
Show Gist options
  • Select an option

  • Save chiehwen/10778038918cccb3702b to your computer and use it in GitHub Desktop.

Select an option

Save chiehwen/10778038918cccb3702b to your computer and use it in GitHub Desktop.

規劃專案的目錄結構

在開始撰寫 gulpfile.js 之前,你必須先將專案的結構規劃出來,

gulp 原理

利用管線(pipe) 串流(streaming)

  • 在 Unix 下,資料被視為位元串流(streaming)
gulp.task(name, fn)
It registers the function with name.
You can optionally specify some dependencies if other tasks need to run first.

gulp.task(tasks...)
Run all tasks with maximum concurrency

gulp.watch(glob, fn)
Runs a function when a file that matches the glob changes
Included in core for simplicity

gulp.src(glob)
This returns a readable stream.
Takes a file system glob (like grunt) and starts emitting files that match.
This is piped to other streams

gulp.dest(folder)
This returns a writable stream
File objects piped to this are saved to the file system
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment