$30 off During Our Annual Pro Sale. View Details »
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
kissy modularization part1
Search
yiminghe
February 21, 2014
Technology
1
1.8k
kissy modularization part1
part1 of kissy modularization tutorials
yiminghe
February 21, 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.4k
Other Decks in Technology
See All in Technology
普段使ってるClaude Skillsの紹介(by Notebooklm)
zerebom
8
2k
フルカイテン株式会社 エンジニア向け採用資料
fullkaiten
0
9.9k
20251222_next_js_cache__1_.pdf
sutetotanuki
0
170
日本Rubyの会: これまでとこれから
snoozer05
PRO
5
220
Oracle Database@AWS:サービス概要のご紹介
oracle4engineer
PRO
1
390
ActiveJobUpdates
igaiga
1
310
20251203_AIxIoTビジネス共創ラボ_第4回勉強会_BP山崎.pdf
iotcomjpadmin
0
130
半年で、AIゼロ知識から AI中心開発組織の変革担当に至るまで
rfdnxbro
0
130
20251219 OpenIDファウンデーション・ジャパン紹介 / OpenID Foundation Japan Intro
oidfj
0
470
[Data & AI Summit '25 Fall] AIでデータ活用を進化させる!Google Cloudで作るデータ活用の未来
kirimaru
0
3.2k
MariaDB Connector/C のcaching_sha2_passwordプラグインの仕様について
boro1234
0
1k
Building Serverless AI Memory with Mastra × AWS
vvatanabe
0
370
Featured
See All Featured
Cheating the UX When There Is Nothing More to Optimize - PixelPioneers
stephaniewalter
286
14k
End of SEO as We Know It (SMX Advanced Version)
ipullrank
2
3.8k
Build your cross-platform service in a week with App Engine
jlugia
234
18k
Navigating Weather and Climate Data
rabernat
0
49
Reality Check: Gamification 10 Years Later
codingconduct
0
1.9k
Building an army of robots
kneath
306
46k
Odyssey Design
rkendrick25
PRO
0
430
Highjacked: Video Game Concept Design
rkendrick25
PRO
0
240
<Decoding/> the Language of Devs - We Love SEO 2024
nikkihalliwell
0
99
Sharpening the Axe: The Primacy of Toolmaking
bcantrill
46
2.6k
Java REST API Framework Comparison - PWX 2021
mraible
34
9k
The Language of Interfaces
destraynor
162
25k
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 • 下节 – 模块加载优化