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
Sponsored
·
Your Podcast. Everywhere. Effortlessly.
Share. Educate. Inspire. Entertain. You do you. We'll handle the rest.
→
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
270
支付宝小程序的开放架构
yiminghe
0
200
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
EBS暗号化に失敗してEC2が動かなくなった話
hamaguchimmm
2
200
All About Sansan – for New Global Engineers
sansan33
PRO
1
1.4k
AWS Agent Registry の基礎・概要を理解する/aws-agent-registry-intro
ren8k
3
380
AIはハッカーを減らすのか、増やすのか?──現役ホワイトハッカーから見るAI時代のリアル【MEGU-Meet】
cscengineer
0
160
Microsoft 365 / Microsoft 365 Copilot : 自分の状態を確認する「ラベル」について
taichinakamura
0
240
MLOps導入のための組織作りの第一歩
akasan
0
340
#jawsugyokohama 100 LT11, "My AWS Journey 2011-2026 - kwntravel"
shinichirokawano
0
350
[OpsJAWS 40]リリースしたら終わり、じゃなかった。セキュリティ空白期間をAWS Security Agentで埋める
sh_fk2
3
240
弁護士ドットコム株式会社 エンジニア職向け 会社紹介資料
bengo4com
1
160
サイボウズ 開発本部採用ピッチ / Cybozu Engineer Recruit
cybozuinsideout
PRO
10
78k
QGISプラグイン CMChangeDetector
naokimuroki
1
400
AzureのIaC管理からログ調査まで、随所に役立つSkillsとCustom-Instructions / Boosting IaC and Log Analysis with Skills
aeonpeople
0
230
Featured
See All Featured
Primal Persuasion: How to Engage the Brain for Learning That Lasts
tmiket
0
320
Highjacked: Video Game Concept Design
rkendrick25
PRO
1
340
Conquering PDFs: document understanding beyond plain text
inesmontani
PRO
4
2.6k
We Analyzed 250 Million AI Search Results: Here's What I Found
joshbly
1
1.2k
Designing for humans not robots
tammielis
254
26k
Templates, Plugins, & Blocks: Oh My! Creating the theme that thinks of everything
marktimemedia
31
2.8k
Six Lessons from altMBA
skipperchong
29
4.2k
Sharpening the Axe: The Primacy of Toolmaking
bcantrill
46
2.8k
Lightning Talk: Beautiful Slides for Beginners
inesmontani
PRO
1
520
What does AI have to do with Human Rights?
axbom
PRO
1
2.1k
How to Grow Your eCommerce with AI & Automation
katarinadahlin
PRO
1
170
Raft: Consensus for Rubyists
vanstee
141
7.4k
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())