$30 off During Our Annual Pro Sale. View Details »
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
gulp-internal
Search
yiminghe
August 22, 2014
Technology
2
5.3k
gulp-internal
implementation about gulp
yiminghe
August 22, 2014
Tweet
Share
More Decks by yiminghe
See All by yiminghe
小程序终端技术架构
yiminghe
0
240
支付宝小程序的开放架构
yiminghe
0
190
gitc2016 react based architecture
yiminghe
1
170
antd at qcon2016
yiminghe
1
230
react-based architecture
yiminghe
2
160
React Ecosystem At Ant Financial
yiminghe
4
2.3k
ant design preview
yiminghe
1
300
react best practice
yiminghe
3
210
react at alipay
yiminghe
43
4.4k
Other Decks in Technology
See All in Technology
研究開発部メンバーの働き⽅ / Sansan R&D Profile
sansan33
PRO
3
21k
プラットフォームエンジニアリングとは何であり、なぜプラットフォームエンジニアリングなのか
doublemarket
1
550
Noを伝える技術2025: 爆速合意形成のためのNICOフレームワーク速習 #pmconf2025
aki_iinuma
2
1k
Modern Data Stack大好きマンが語るSnowflakeの魅力
sagara
0
280
名刺メーカーDevグループ 紹介資料
sansan33
PRO
0
980
Master Dataグループ紹介資料
sansan33
PRO
1
4k
著者と読み解くAIエージェント現場導入の勘所 Lancers TechBook#2
smiyawaki0820
7
2.8k
法人支出管理領域におけるソフトウェアアーキテクチャに基づいたテスト戦略の実践
ogugu9
1
110
A Compass of Thought: Guiding the Future of Test Automation ( #jassttokai25 , #jassttokai )
teyamagu
PRO
1
190
20251127 BigQueryリモート関数で作る、お手軽AIバッチ実行環境
daimatz
0
430
Bakuraku Engineering Team Deck
layerx
PRO
11
5.7k
Eight Engineering Unit 紹介資料
sansan33
PRO
0
5.7k
Featured
See All Featured
Site-Speed That Sticks
csswizardry
13
990
4 Signs Your Business is Dying
shpigford
186
22k
Fantastic passwords and where to find them - at NoRuKo
philnash
52
3.5k
Building a Modern Day E-commerce SEO Strategy
aleyda
45
8.3k
Why You Should Never Use an ORM
jnunemaker
PRO
60
9.6k
How Fast Is Fast Enough? [PerfNow 2025]
tammyeverts
3
380
Optimizing for Happiness
mojombo
379
70k
How To Stay Up To Date on Web Technology
chriscoyier
791
250k
ピンチをチャンスに:未来をつくるプロダクトロードマップ #pmconf2020
aki_iinuma
128
54k
Connecting the Dots Between Site Speed, User Experience & Your Business [WebExpo 2025]
tammyeverts
10
700
VelocityConf: Rendering Performance Case Studies
addyosmani
333
24k
Optimising Largest Contentful Paint
csswizardry
37
3.5k
Transcript
Gulp-internal
[email protected]
Gulp • A build system based on stream
sample • gulpfile.js: var gulp = require(‘gulp’) gulp.src(‘lib/**/*.js’) .pipe(concat()) .pipe(rename(‘concat.js’))
.pipe(gulp.dest(‘build’)) • run: gulp
feature • No temporary file • virtual memory file content
transfer • Full stream support • stream. Readable • stream. Writable • stream. Transform • through2
gulp • global cli • local lib • plugins/streams
cli • Depends • liftoff Change cwd require gulpfile require
gulp .start
through2 • Easy to create stream.Transform and compatible with 0.8-
• through2(option, function transform(chunk,encoding,callback){},function flush(){}) • === • var stream = new MyTransform(option); // extends stream.Transform stream._transform = transform; stream._flush = flush; return stream;
Local lib • Api • Gulp.src • Gulp.dest • Gulp.task
• * Gulp.watch • Depends • vinyl • vinyl-fs • orchestrator
vinyl • Virtual file representation • { content: buffer/stream path:
}
Gulp.src • === require(‘vinyl-fs’).src • return stream.Transform({object:true}) • Emit Stream
of vinyl file
Gulp.dest • === require(‘vinyl-fs’).dest • return stream.Transform({object:true}) • Save file
and Emit Stream of saved vinyl file
Orchestrator • A module for sequencing and executing tasks and
dependencies in maximum concurrency • Gulp.task(name, deps, function(){}) • KISSY.add(name,deps,function(){}) • ‘default’
Task end condition • Promise resolved • Callback called •
Stream end • Task(‘x’,function(callback){ • Return promise or stream • Or • Callback() • });
plugins • Return stream.Transform • Operate on vinyl file •
Example • Gulp-concat • Gulp-uglify • Gulp-modulex
• gulp.src(‘./gulp-internal’).pipe(audience()).pipe(thanks())