Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
kissy modularization part1
Search
yiminghe
February 21, 2014
Technology
1.8k
1
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
kissy modularization part1
part1 of kissy modularization tutorials
yiminghe
February 21, 2014
More Decks by yiminghe
See All by yiminghe
小程序终端技术架构
yiminghe
0
350
支付宝小程序的开放架构
yiminghe
0
280
gitc2016 react based architecture
yiminghe
1
200
antd at qcon2016
yiminghe
1
260
react-based architecture
yiminghe
2
200
React Ecosystem At Ant Financial
yiminghe
4
2.3k
ant design preview
yiminghe
1
360
react best practice
yiminghe
3
250
react at alipay
yiminghe
43
4.6k
Other Decks in Technology
See All in Technology
「AIチャットからもできないの?」と言われたら ~業務アプリをMCP対応するときの認証・認可の勘所
oidfj
0
240
Kiro Crew 入門 (手を離しても進む仕事) | 目指せ Kiro マスター 11
inariku
PRO
4
650
なぜ東京にいる私が、新潟の技術コミュニティを運営するのか by 八雲慎之助
yakumo
0
230
Metadata - Section 3 : Dublin Core Standard · DC
mohab1
0
120
AIがGISを代替する日:〜すべてをAIが創る時代に、私たちがFOSS4Gに関わる意味〜
lehupa
1
210
基本から分かる!AWSセキュリティ運用の考え方と任せ方
cmusudakeisuke
1
470
Active Directory と Entra ID のむむむな関係
murachiakira
PRO
4
1.7k
ライフワーク「猫でもわかるDirectConnect」
kentapapa
0
300
Kiro IDE 入門 (画面の各部から、頼み方、任せ方、戻し方まで) | 目指せ Kiro マスター 02
inariku
PRO
4
170
81天的 AI Agent 軟體開發團隊治理實務分享
regionbbs
0
130
コードレビューをなくして見えたもの
henteko
0
140
re:Invent2026 事前勉強会 歴史と愉しみ方10分LT編
toshi_atsumi
0
170
Featured
See All Featured
The Success of Rails: Ensuring Growth for the Next 100 Years
eileencodes
47
8.4k
Why You Should Never Use an ORM
jnunemaker
PRO
61
10k
Un-Boring Meetings
codingconduct
0
490
[RailsConf 2023] Rails as a piece of cake
palkan
59
7.1k
More Than Pixels: Becoming A User Experience Designer
marktimemedia
3
620
GraphQLとの向き合い方2022年版
quramy
50
15k
Writing Fast Ruby
sferik
630
63k
16th Malabo Montpellier Forum Presentation
akademiya2063
PRO
0
460
Easily Structure & Communicate Ideas using Wireframe
afnizarnur
194
17k
Rails Girls Zürich Keynote
gr2m
96
14k
Into the Great Unknown - MozCon
thekraken
41
2.8k
For a Future-Friendly Web
brad_frost
184
11k
Transcript
KISSY Modularization part 1
[email protected]
理论基础 • 模块是一致紧密相连的程序单元 • 模块提供功能,并描述自身所依赖的模块 • 模块具备高内聚,低耦合的特性 • 方便多人协作
传统的前端模块化 • page.html • <html> <link ref=‘stylesheet’/> <link ref=‘stylesheet’/> <div></div>
<div></div> <script></script> <script></script> </html>
问题 • 线性结构,不符合直观 • css html javascript 互不相关
线性结构 模块1 模块2 模块3
理想的模块 • 树状结构,模块可依赖多个其他模块 • 一个模块包括 html css javascript 三部分, 也就是内聚的意思
树状结构 main 模块1 模块3 模块4 模块2 模块3
• KISSY Modularization
KISSY 模块化方案 • css + js + template = KISSY
module • package = modules • 示例: https://github.com/yiminghe/kissy- boilerplate • http://localhost:8111/
• API
主要 api • KISSY.add(function) – 定义模块 • amd • cmd
主要 api • 使用模块 – KISSY.use(modules, function) – KISSY.use(modules, {success,
error}) • 环境配置 – KISSY.config()
环境配置的一些参数 • KISSY.config – combine 优化相关 – alias 别名机制 –
lang 全球化 – packages 包配置 • name 包名 • path 包路径 • charset 文件编码
• template
template • xtemplate template module compile
compile • nodejs • kissy-xtemplate -w –p src/ – src
下的 xx-tpl.html => xx-tpl.js (compiled function) – 业务模块 require(‘./xx-tpl’)
compiled template • xx-tpl.html • kissy-xtemplate –p ./ • xx-tpl.js
use compiled template
• conditional loader
conditional loader • compatible(ie) module
conditional loader • Touch modules
• gallery
• KISSY.use(‘gallery/xx/ver/’) • Just use it!
Mini? • API 简化版面向于浏览型 web page – http://m.kissyui.com/ – http://g.assets.daily.taobao.net/kissy/m/0.
1.1/mini.js
未来的生态圈 loader kissy • Dom • Event • Base •
xtemplate • Components • … Mini • Dom • Event • Anim • Io • … Gallery • uploader • Kcharts • Slide • Layer-anim • auth • …
• nodejs
nodejs • npm install
[email protected]
• var S = require(‘kissy’)
kissy modules on nodejs • asynchronous – S.use(modules, function) •
synchronous – Like require on nodejs – S.use(modules, {success:function, sync:true}) • KISSY 1.5 next – require(‘kissy/lib/xtemplate’)
thanks • 下节 – 模块加载优化