Is it better to load many small JavaScript files or one large JavaScript file?

前端 未结 5 967
自闭症患者
自闭症患者 2021-02-05 13:43

I have noticed in chrome that if I load an image as a base64 string and then scroll through that part of the page it will slow down.

I have also noticed that when I navi

5条回答
  •  生来不讨喜
    2021-02-05 14:10

    I recently had the same problem, and then I developed and released a JS library (MIT licence) to do this. Basically, you can put all your stuff (js, images, css ...) into a standard tar archive (which you can create server side), and the library reads it and allows you to easily use the files.

    You'll find it here : https://github.com/sebcap26/FileLoader.js

    It works with all recents browsers and IE >= 10.

提交回复
热议问题