Skip to content

37.如何进行网站性能优化? #37

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Open
webVueBlog opened this issue Mar 15, 2020 · 1 comment
Open

37.如何进行网站性能优化? #37

webVueBlog opened this issue Mar 15, 2020 · 1 comment
Labels
性能优化 性能优化

Comments

@webVueBlog
Copy link
Member

content方面

减少HTTP请求:合并文件、CSS精灵、inline Image
减少DNS查询:DNS缓存、将资源分布到恰当数量的主机名
减少DOM元素数量

Server方面

使用CDN
配置ETag
对组件使用Gzip压缩

Cookie方面

减小cookie大小

css方面

将样式表放到页面顶部
不使用CSS表达式
使用<link>不使用@import

Javascript方面

将脚本放到页面底部
javascriptcss从外部引入
压缩javascriptcss
删除不需要的脚本
减少DOM访问

图片方面

优化图片:根据实际颜色需要选择色深、压缩
优化css精灵
不要在HTML中拉伸图片

@webVueBlog webVueBlog added the 性能优化 性能优化 label Mar 15, 2020
@webVueBlog
Copy link
Member Author

The content in

Reduce HTTP requests: merge files, CSS sprites, inline Image
Reduce DNS lookups: DNS caching, distributing resources to the appropriate number of host names
Reduce the number of DOM elements

The Server side

Use the CDN
Configure the ETag
Use Gzip compression for the component

Cookie aspects

Reduce the cookie size

CSS aspects

Place the style sheet at the top of the page
No CSS expressions are used
Use instead of @import

In Javascript

Place the script at the bottom of the page
Introduce javascript and CSS from the outside
Compress javascript and CSS
Delete unwanted scripts
Reduce DOM access

pictures

Optimize the picture: according to the actual color needs to choose the color depth, compression
Optimize CSS Sprite
Do not stretch images in HTML

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
性能优化 性能优化
Projects
None yet
Development

No branches or pull requests

1 participant