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
淘宝本地生活 Mini Head 实践
Search
Sponsored
·
Your Podcast. Everywhere. Effortlessly.
Share. Educate. Inspire. Entertain. You do you. We'll handle the rest.
→
d2forum
August 03, 2012
140
2
Share
淘宝本地生活 Mini Head 实践
淘宝公用头脚本比较大,而head中的脚本会阻塞页面渲染,通过mini head来有效解决head过重问题
d2forum
August 03, 2012
More Decks by d2forum
See All by d2forum
TMS的PHP特性
d2forum
0
1.6k
Leap Motion体感实战
d2forum
0
1.2k
跨终端产品实践
d2forum
12
1.9k
Touching Future—s01-e01
d2forum
2
920
KissyCake
d2forum
3
800
贡献标准.s01.e02
d2forum
3
1.3k
一淘响应式设计实践
d2forum
10
990
响应式web设计与实现介绍
d2forum
8
820
定制版设计开发vs响应式设计开发
d2forum
0
190
Featured
See All Featured
WCS-LA-2024
lcolladotor
0
570
Everyday Curiosity
cassininazir
0
200
A better future with KSS
kneath
240
18k
GitHub's CSS Performance
jonrohan
1032
470k
Digital Projects Gone Horribly Wrong (And the UX Pros Who Still Save the Day) - Dean Schuster
uxyall
0
1.3k
Agile that works and the tools we love
rasmusluckow
331
21k
The Web Performance Landscape in 2024 [PerfNow 2024]
tammyeverts
12
1.1k
Discover your Explorer Soul
emna__ayadi
2
1.1k
Claude Code どこまでも/ Claude Code Everywhere
nwiizo
65
55k
Darren the Foodie - Storyboard
khoart
PRO
3
3.3k
My Coaching Mixtape
mlcsv
0
120
Done Done
chrislema
186
16k
Transcript
本地生活 Mini 头实践 —— 元晃
OVERVIEW OVERVIEW head 里的 js 头大的问题 解决问题 部署 && 应用
head 里的 js head • 125KB+ • 45KB+ gzip
头大的问题 头大的问题 • 阻塞 ——head 中的脚本会阻塞页面渲染!
头大的问题 头大的问题 <!doctype html> <html> <head> <title>js 阻塞测试 </title> </head>
<body> 主体 </body> </html> <script src="sleep.php?delay=20"></script> 20s
解决问题 解决问题 • 让 head 轻一点 —— 把 head 中的脚本往页面底部挪
解决问题 解决问题 • 但是……
解决问题 HOW? 解决问题 • 作假
解决问题 • 单击此处编辑母版文本样式 – 第二级 – 第三级 • 第四级 –
第五级
解决问题 存储匿名函数
解决问题 • 单击此处编辑母版文本样式 – 第二级 – 第三级 • 第四级 –
第五级 取出匿名函数并执行
• 一个轻量头解决方案 • 只有 50 行左右 • 改造成本低
量化 • HttpWatch • 注意 -HttpWatch 的 clear cache 功能可能有问
题,请用 IE 自带的工具条设置“总是从服务器 更新” Render Start DOM Load Page Load
部署 • 两部分 -mini_core.js 20 行左右,直接写在 head 中 -mini_exe.js 30
行左右 • Source and test code • 本地生活
The End