PDA

View Full Version : Compresses and uncompressed JS and CSS-Files



joinsky
20 Jul 2011, 6:14 AM
Sencha Touch offers compressed and uncompressed JS and CSS-Files. The compressed files are those, in which everything in written in one line without any space. I read that for development you should use the uncompressed file. I dont really understand why. What advantages do the uncompressed files have and why can you not develop using the compressed files.

mbalsam
20 Jul 2011, 7:10 AM
You can develop using compressed files but debugging will be a pain with them. WebKit browsers like Chrome or Safari have a JavaScript console that let's you step through the code at runtime watch variables etc.. Stepping through the code is done line by line so you don't have a good chance to find out anything if all your code is one line. Furthermore the compressed files are hardly readable for the human eye. If you're trying to develop a serious app you won't get far without trying to understand the sencha code by inspecting it at runtime.

eyepoker
20 Jul 2011, 7:11 AM
the advantage i can see is that you can add console.logs and alerts to the unminified code to help with debugging.... the minified versions are essential unreadable so its not practical for adding in messages, should you need to.

Sencha provides two debug files, one for your own uses should you want to add your own console.logs or its debugging with comments version. The later contains commented out logging that you can use and can be quite helpful. however, the debug versions are bigger than the minified version. The debug with comments is bigger yet. Take a look at the file sizes.

In the end, even though you could run with the unmini'd versions, you'd want the mini'd ones for smaller file size and faster parsing. The speed gains are sometimes not all that noticeable. Depends on a few things.... but we should always want to optimize what we're doing. Thus the recommendation to use the mini'd files.

You can just as well only ever user the minified code if you like.

joinsky
21 Jul 2011, 7:23 AM
If you develop with the compressed or uncompreed files and you have a programming error your editor will tell you the line, won't it? Is that true?
If this is true, this can be regarded as another adavantage of the uncompressed files, because then you can look which line is wrong. If you have an porgramming error when using the compressed file you will not know what you are doing wrong.

SO, is this true or not?

Hertz
21 Jul 2011, 9:07 AM
If you develop with the compressed or uncompreed files and you have a programming error your editor will tell you the line, won't it? Is that true?

True, but if a method/function from Sencha Touch library throws an error (if you pass wrong data to a function's parameter for example), it will be output in whatever debug console you use (Google Developer Tools, etc.), not your Editor.
And Yes, since you're using the uncompressed version, most of the times you will know which line of code in the library the error is being reported from / is occurring.


If you have an porgramming error when using the compressed file you will not know what you are doing wrong.

SO, is this true or not?

True and not true. Sometimes your error is only from plain JavaScript and has nothing to do with Sencha Touch library.