Common practice is to combine and minimize external JS libraries and css files

Is it common practice to combine and minimize external JS libraries and css files, or should only user-created CSS and JS files be combined and minimized?

+4
source share
3 answers

It is best to combine and minimize external js and css files. This results in fewer requests and longer load times.

It doesn't matter if they are application specific or library specific, like jquery. Just make sure that code that depends on your libraries is merged after the libraries.

+2
source

YES - if you do not want to use CDN copies of these external libraries (if available), you can save on loading if the browser caches correctly ...

+2
source

There is nothing wrong with this, the obvious benefit is that, to some extent, the load time will be faster. We did it (in my current company) where possible. Obvious warning words, of course:

  • Test carefully after you have minimized (and before you go live) - some minifiers are not always 100% reliable (and in the past we had some functions for some functions).

  • Watch how you minimize - during the days of setting up our build process there were situations when some files were somehow evaluated twice (i.e. some third-party things were already rated) - caused a lot of problems ... (don’t ask me, why!)

+1
source

Source: https://habr.com/ru/post/1399015/


All Articles