Frontend optimization Summary

Source: Internet
Author: User
Frontend optimization homepage Optimization

The homepage is the page with the most traffic, so its resources should be independent. This page should have the highest priority and the greatest degree of optimization should be:

  • Image independent service. CSS Sprites is an image only used on the home page. It does not contain any additional images/icons on any other pages.
  • CSS-index.css for the first page. To achieve this, we need to use the preprocessing tool to modularize CSS and then merge it.
  • Import other than reset.css in the same format and set the cache
  • Embedding index.css and index. js in line to reduce HTTP requests
  • Compress index.html during project release
Reduce HTTP requests
  • Merge JS/CSS/IMG: Merge gruntjs, merge SCSs, and merge sprites
  • Inline files in an HTML file or set cache for external resources
Set Cache
  • Resource adoptionFile Content-based hash version RedundancyFor example:
    This should not be written when a script is introduced.

    But the source code of the Project is

    After the project is released

    However, this requires a complete set of tools. For details, refer:
    Http://www.infoq.com/cn/articles/front-end-engineering-and-performance-optimization-part1

Reduce resource size
  • Delete unused codes, comments, and blank spaces
  • Minimize compression code
Delayed Loading
  • First, load the images in the visible view. The following images are not loaded at the moment. The images will be loaded when they scroll to or slide.
Pre-Load
  • After loading the resources on page N, the backend will start to automatically load the resources on page n + 1.
Make small details
  • Use CDN to link resources
  • Avoid redirection
  • Put CSS link in and JS at the bottom
  • Do not use @ import for CSS Import
  • Do not use </LI> </ul>

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.