Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
gulp-internal
Search
yiminghe
August 22, 2014
Technology
5.5k
2
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
gulp-internal
implementation about gulp
yiminghe
August 22, 2014
More Decks by yiminghe
See All by yiminghe
小程序终端技术架构
yiminghe
0
280
支付宝小程序的开放架构
yiminghe
0
220
gitc2016 react based architecture
yiminghe
1
190
antd at qcon2016
yiminghe
1
250
react-based architecture
yiminghe
2
190
React Ecosystem At Ant Financial
yiminghe
4
2.3k
ant design preview
yiminghe
1
340
react best practice
yiminghe
3
230
react at alipay
yiminghe
43
4.5k
Other Decks in Technology
See All in Technology
UIパーツの設計を「型」から読み解く 〜TSKaigiのセッションから得た学び〜
yud0uhu
0
100
Comment regagner la souveraineté de vos données tout en étant payé grâce à Nostr !
rlifchitz
0
210
製造現場での生成AIの活用、およびエージェントAIの実装のあり方、AVEVAの取り組み
iotcomjpadmin
0
180
AI 不只幫你寫 Code: 當專案從 300 暴增到 1500, 我們如何撐住 DevOps
appleboy
0
270
作る力から、見極める力へ — AI時代に広がるエンジニアの価値と役割
rince
0
350
コミュニティの有益性 ~JAWS Days 2026 での体験を通して~ / The Benefits of a Community ~Through My Experience at JAWS Days 2026~
seike460
PRO
0
290
ご挨拶「10周年を迎える共創ラボのこれまでとこれから」
iotcomjpadmin
0
140
When Platform Engineering Meets GenAI
sucitw
0
200
10年間のブログ発信を振り返って見えたWebアプリケーションエンジニアとしての軌跡
stefafafan
0
190
從開發到部署全都交給 AI:實作 AI 驅動的自動化流程
appleboy
0
180
事業会社における 機械学習・推薦システム技術の活用事例と必要な能力 / ml-recsys-in-layerx-wantedly-2026
yuya4
0
160
AIに障害切り分けを全部やってもらった。 。 。 。
estie
0
220
Featured
See All Featured
Practical Tips for Bootstrapping Information Extraction Pipelines
honnibal
25
2k
10 Git Anti Patterns You Should be Aware of
lemiorhan
PRO
659
62k
DevOps and Value Stream Thinking: Enabling flow, efficiency and business value
helenjbeal
1
250
Agile Leadership in an Agile Organization
kimpetersen
PRO
0
170
AI Search: Where Are We & What Can We Do About It?
aleyda
0
7.6k
Statistics for Hackers
jakevdp
799
230k
Why Your Marketing Sucks and What You Can Do About It - Sophie Logan
marketingsoph
0
170
Navigating Weather and Climate Data
rabernat
0
240
Writing Fast Ruby
sferik
630
63k
Building Flexible Design Systems
yeseniaperezcruz
330
40k
Responsive Adventures: Dirty Tricks From The Dark Corners of Front-End
smashingmag
254
22k
Designing for Timeless Needs
cassininazir
1
260
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())