$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
310
react best practice
yiminghe
3
220
react at alipay
yiminghe
43
4.5k
Other Decks in Technology
See All in Technology
Claude Codeを使った情報整理術
knishioka
11
6.5k
特別捜査官等研修会
nomizone
0
580
Oracle Database@Google Cloud:サービス概要のご紹介
oracle4engineer
PRO
1
770
まだ間に合う! Agentic AI on AWSの現在地をやさしく一挙おさらい
minorun365
17
2.8k
Strands Agents × インタリーブ思考 で変わるAIエージェント設計 / Strands Agents x Interleaved Thinking AI Agents
takanorig
5
2.1k
AWSに革命を起こすかもしれない新サービス・アップデートについてのお話
yama3133
0
510
AWSインフルエンサーへの道 / load of AWS Influencer
whisaiyo
0
220
子育てで想像してなかった「見えないダメージ」 / Unforeseen "hidden burdens" of raising children.
pauli
2
330
『君の名は』と聞く君の名は。 / Your name, you who asks for mine.
nttcom
1
120
フィッシュボウルのやり方 / How to do a fishbowl
pauli
2
390
たまに起きる外部サービスの障害に備えたり備えなかったりする話
egmc
0
410
AIBuildersDay_track_A_iidaxs
iidaxs
4
1.3k
Featured
See All Featured
Are puppies a ranking factor?
jonoalderson
0
2.4k
The Hidden Cost of Media on the Web [PixelPalooza 2025]
tammyeverts
2
120
Building a Modern Day E-commerce SEO Strategy
aleyda
45
8.4k
How to Think Like a Performance Engineer
csswizardry
28
2.4k
SEOcharity - Dark patterns in SEO and UX: How to avoid them and build a more ethical web
sarafernandez
0
89
The State of eCommerce SEO: How to Win in Today's Products SERPs - #SEOweek
aleyda
2
9.1k
Agile Leadership in an Agile Organization
kimpetersen
PRO
0
58
The #1 spot is gone: here's how to win anyway
tamaranovitovic
1
870
Automating Front-end Workflow
addyosmani
1371
200k
sira's awesome portfolio website redesign presentation
elsirapls
0
89
Mobile First: as difficult as doing things right
swwweet
225
10k
30 Presentation Tips
portentint
PRO
1
170
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())