Generally speaking, regarding the acceleration of the website, most people think it is the responsibility of the back-end developers and system management. This concept is not entirely correct, because a high-functioning website depends not only on the back end of the website, but also on the front end of the website, that is to say, it also depends on artists and front-end developers.
In fact, as far as the current network environment is concerned, when we read a normal website, we generally spend 10-20% of the time on the back end, and the remaining 80-90% of the time is consumed by the front end. Therefore, if you plan to increase the speed of your website, you may wish to optimize the backend and let the artists and front-end developers think about the following aspects. I believe you may sigh that you can effectively improve the function of the website without much effort.
1. Minimize the number of HTTP requests. For example: replace multiple images with one image, and then use CSS to display. Use CDN to speed up the website. CDN can greatly improve the speed of website visits without changing the original website architecture. Especially for sites with national (or worldwide) users, the effect will be more significant.
2. The CSS file is placed in the header of the page. It is necessary for the reader to get CSS before displaying the page. Otherwise, the page cannot be displayed. So it's wise to put CSS files in the header of the page. Bole Online's development team has tested before. If a page contains multiple JS files, a CSS file is placed at the end of the page. When the user reads the page, it is very obvious that the page is blank (download JS and other files), and then it appears. Obviously, in this case, the user experience is very poor. In contrast, if you place the CSS file in the head of the page, users can see the page first (the page is not significantly blank) when reading the page.
3. The JS file is placed at the end of the page. The reason is the same as putting the CSS file in the header of the page.
4. Store the CSS and JS code in a separate file from the page. Today, many readers, such as Firefox, IE 7, 8, etc., will cache images, CSS, JS and other external files locally on the user. Therefore, when users read pages through these readers, only the text content of the page is transmitted, not again. Download images, CSS, JS and other external files. In this way, the speed of visits can naturally be improved a lot. In addition, the CSS and JS code are stored in a separate file from the page, which is also easy to manage.
5. "Losing Weight" for JS. Compress JS with third-party stuff (no need to do it by hand), including deleting comments, spaces, etc. Generally, it can reduce 20%. For example, JS is 100KB before "weight loss" and 80KB after "weight loss".Except for the second item, the other five aspects are related to art and front-end developers. More unmentioned tips are welcome to add.