Put javascript and css inline in a single minified html file to improve performance?

后端 未结 5 1645
孤独总比滥情好
孤独总比滥情好 2021-02-13 02:29

A typical website consists of one index.html file and a bunch of javascript and css files. To improve the performance of the website, one can:

  • Minify the javascrip
5条回答
  •  南方客
    南方客 (楼主)
    2021-02-13 03:15

    You can have a single CSS for all your pages and since it will be cached, the subsequent pages will refer it from cache without sending extra request.

    However, putting all Javascript files is into one is contextual. Most probably you might be using libraries like jQuery, and relevant plugins. This 'might' throw conflicting issues between plugins. So, before you try it all at once, try merging few files at once and checking if the error pops or not.

提交回复
热议问题