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.4k
2
Share
gulp-internal
implementation about gulp
yiminghe
August 22, 2014
More Decks by yiminghe
See All by yiminghe
小程序终端技术架构
yiminghe
0
280
支付宝小程序的开放架构
yiminghe
0
210
gitc2016 react based architecture
yiminghe
1
180
antd at qcon2016
yiminghe
1
240
react-based architecture
yiminghe
2
180
React Ecosystem At Ant Financial
yiminghe
4
2.3k
ant design preview
yiminghe
1
330
react best practice
yiminghe
3
230
react at alipay
yiminghe
43
4.5k
Other Decks in Technology
See All in Technology
エンタープライズの厳格な制約を開発者に意識させない:クラウドネイティブ開発基盤設計/cloudnative-kaigi-golden-path
mhrtech
0
430
分断された OT と IT を繋ぐ架け橋 -Kubernetes が切り拓く 産業用組み込み製品の現在地 -
yudaiono
1
110
LookerとADKで作る社内AIエージェント
chanyou0311
0
220
JTCでRedmine利用者2700人を実現した手法 第二部
nobuonakamura
0
110
Purview Endpoint DLP 動かしてみた
kozakigh
0
410
Claude Codeウェビナー資料 - AWSの最新機能をClaude Codeで高速に検証する
oshanqq
0
770
SLI/SLO、「完全に理解した」から「チョットデキル」へ
maruloop
5
510
セキュリティ対策、何からはじめる? CloudNative環境の脅威モデリングと リスク評価実践入門 #cloudnativekaigi
varu3
5
920
毎日の作業を Claude Code 経由にしたら、 ノウハウがコードになった
kossykinto
1
1.4k
Vision Banana: Image Generators are Generalist Vision Learners
kzykmyzw
0
380
AWS WAFの運用を地道に改善し、自社で運用可能にするプラクティス
andpad
1
220
「強制アップデート」か「チームの自律」か?エンタープライズが辿り着いたプラットフォームのハイブリッド運用/cloudnative-kaigi-hybrid-platform-operations
mhrtech
0
200
Featured
See All Featured
Thoughts on Productivity
jonyablonski
76
5.1k
DevOps and Value Stream Thinking: Enabling flow, efficiency and business value
helenjbeal
1
190
Google's AI Overviews - The New Search
badams
0
1k
Building a Scalable Design System with Sketch
lauravandoore
463
34k
What does AI have to do with Human Rights?
axbom
PRO
1
2.1k
The Web Performance Landscape in 2024 [PerfNow 2024]
tammyeverts
12
1.1k
sira's awesome portfolio website redesign presentation
elsirapls
0
240
Groundhog Day: Seeking Process in Gaming for Health
codingconduct
0
170
How to optimise 3,500 product descriptions for ecommerce in one day using ChatGPT
katarinadahlin
PRO
1
3.6k
Un-Boring Meetings
codingconduct
0
290
The Pragmatic Product Professional
lauravandoore
37
7.3k
Ruling the World: When Life Gets Gamed
codingconduct
0
230
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())