开发者

Minimizing Javascript [closed]

开发者 https://www.devze.com 2023-03-21 07:17 出处:网络
It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical andcannot be reasonably answered in its current form. For help clari
It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center. Closed 11 years ago.

Ok, so I just learned about minimizing JS to make it load quicker, so what I've been doing is copying that and putting it into the JSbeautifier. However, when I do this it comes back as like 7k lines of JS and I'm curious if this is just one function or a whole library or does it开发者_开发知识库 depend?


The whole idea of minifying the javascript is to remove any and all unnecessary line breaks and white space and in the case of a good minifyers, it will rename variables as well.

The beautifyer ADDS line breaks and white space so as to make things more readable, which means you're circumventing the whole point of minification by putting your code into the beautifier. Run the beautifier on your non-minified code to make it more readable for you and when you're ready to publish it to the web, then minify it. Minified javascript is not meant to be readable.

I usually keep a development version and a release version. I test locally and then when I upload my changes, I minify.

Hope this helps.


To minify and/or pack, you can use jscompress.com

0

精彩评论

暂无评论...
验证码 换一张
取 消