Pages

Monday, April 14, 2014

The Issue of Legibility

Those of you that have been working with Sugar 7 have likely already noted that much of the JavaScript code utilized is minified. While that is a nifty trick to squeeze out some more performance, it makes code very difficult to read, such as the snippet inserted below:

({inlineEditMode:false,createMode:false,plugins:['SugarLogic','ErrorDecoration','GridBuilder','Editable','Audit','FindDuplicates','ToggleMoreLess'],enableHeaderButtons:true,enableHeaderPane:true,events:{'click .record-edit-link-wrapper':'handleEdit','click a[name=cancel_button]':'cancelClicked','click [data-action=scroll]':'paginateRecord','click .record-panel-header':'togglePanel','click .tab a':'setActiveTab'},buttons:null...

From the standpoint of a consultant, and one in charge of applying code level modifications to a given Sugar instance, having to unravel code like this in order to work on a customization is a bit of a nightmare. One is also put in a situation in which one has to rely on the use of JavaScript beautifiers and similar tools to display the code in a more legible manner. 

No need to worry, however. Legible versions of the JavaScript code that Sugar utilizes and in turn, minifies, are easily accessible, thus simplifying our work. The table below gives us a listing of the various file locations that might be of interest to developers:


Minified Files
Un-minified Source
/clients/base/views/
/jssource/src_files/clients/base/views/
/clients/base/layouts/
/jssource/src_files/clients/base/layouts/
/clients/base/fields/
/jssource/src_files/clients/base/fields/
/modules/<Module>/clients/base/
/jssource/src_files/modules/<Module>/clients/base/

In future posts we will take a closer look at other aspects of the file system that are equally important.

Have fun exploring!

No comments:

Post a Comment

Your comments, feedback and suggestions are welcome, but please refrain from using offensive language and/or berating others. Thank you in advance.