3 ms·
I'm curious why there is a problem with making "the file look messy?" Your users will likely never look at it (unless you are building something for JS develope
by pilom 15y ago
I'm curious why there is a problem with making "the file look messy?" Your users will likely never look at it (unless you are building something for JS developers) and the compression should really only be a step in your deploy (save, compress, run tests, deploy to server). So theoretically no one should ever look at the compressed files. That being said if you have a lot of JS it can really improve load times of sites but thats about it.
As for the 2 options you listed, there are 2 benefits of option 1 over 2 (given that no one is ever going to look at the compressed files). First, some JS compressors do a better job when they have all the files together as one large file. Second, consolidating them all down to 1 file significantly decreases the number of requests the client has to make to your server. This reason alone will probably have a bigger impact on your sites performance than compressing the files alone so I would definitely recommend you look into it.
- andrewhillman 15y agoWell "messy" makes it harder for me to read and I prefer neat code. Do you have any recommendations on sites that compress js files? I've noticed several sites, but not sure if one is better than another. Thank you for your input. It is appreciated.
- polyfractal 15y agoAs pilom mentioned, no one will be reading your compressed (also known as "minified") code. Your day-to-day programming will be in a non-compressed form of JS. When your code is release-ready, you go through the aforementioned deployment process. I tend to use YUIcompressor, but I don't think any of them differ much.
- andrewhillman 15y agothank you.