Read someone else's code refactoring experience Feel good, special reprint, and so on their own experience after to add.
http://www.sxt.cn/u/4647/blog/5584
Briefly, code refactoring roughly includes the following:
- CSS,JS is modular and is placed as much as possible in the same file to reduce the number of requests
- Simplified and unified external framework with repetitive functions
- Improve page load performance by adjusting resource loading order, using compressed resources, or Sprite graphs
- Code style refinement normalization, such as naming style and indentation
However, it is necessary to anticipate risks during the refactoring process to avoid introducing more difficult bugs to detect. and develop the habit of testing each part of the change, and record performance-related parameters for each test to facilitate later analysis.
As for the performance test, this article summarizes well.
Front-end Code refactoring