Reputation: 46740
Is it usual practice to combine and minify external JS libraries and css files or should only user generated CSS and JS files be combined and minified?
Upvotes: 4
Views: 1731
Reputation: 1717
There's certainly nothing wrong with this, the obvious benefit is that to some degree to load time will be quicker. We have done this (in my current company) wherever possible. Obvious words of warnings are of course:
Test thoroughly after you've minified (and before you go live) - some minifiers aren't always 100% reliable (and have broken some functionality for us in the past).
Keep track of how you're minifying - back in the days of configuring our build process there were situations where some files somehow got minified twice (i.e. some third party stuff was already minified) - caused a heap of problems... (don't ask me why!)
Upvotes: 1
Reputation: 4532
YES - unless you want to take advantage of CDN copies of those external libraries (when available), can save up some loading when cached correctly by the browser...
Upvotes: 2
Reputation: 43067
It is best practice to combine and minify external js and css files. This results in fewer requests and faster load times.
It doesn't matter if they are application specific or a library such as jquery. Just make sure that code that relies on your libraries are combined after the libraries.
Upvotes: 2