PDA

View Full Version : Minimal ExtJS



gi.sasi
29 Nov 2010, 10:32 PM
Hello,
Is it possible to have minimal code in ExtJS that is if am going to use only Form related items then I don't want load anything other than Form related item. I using ExtJS 3.2 version. (Say for I use only Combobox, TextField, TextArea, Label and Buttons)

Since loading entire ExtJS taking some time. so any help regarding this?

Thanks
Sasikumar

Condor
29 Nov 2010, 11:44 PM
Use JSBuilder2 (here is a description (http://www.sencha.com/forum/showthread.php?74274-What-is-the-role-of-JSBuilder2-and-how-to-use-it)).

gi.sasi
30 Nov 2010, 4:05 AM
Hello Condor,

Thanks for your reply. I already using compressed file, is that any way to use minimalistic ExtJS to load only necessary Java Scripts.

Thanks
Sasikumar


Hello,
Is it possible to have minimal code in ExtJS that is if am going to use only Form related items then I don't want load anything other than Form related item. I using ExtJS 3.2 version. (Say for I use only Combobox, TextField, TextArea, Label and Buttons)

Since loading entire ExtJS taking some time. so any help regarding this?

Thanks
Sasikumar

Condor
30 Nov 2010, 4:55 AM
"I already using compressed file"

Compressed how? Did you actually exlude the parts you didn't need and built one single .js file from Ext and your own code?

gi.sasi
1 Dec 2010, 1:58 AM
Sorry for the late reply. We used Server Side compression(Apache Tomcat) to compress the JS and CSS files. Right now am working with jsb2

Thanks
Sasikumar

Condor
1 Dec 2010, 6:28 AM
Does your server-side compression also do minification? I think it's only doing GZip compressing.

gi.sasi
1 Dec 2010, 10:24 PM
Yes you are correct it is doing only GZip compression. So only I now working with jsb2 by removing unnecessary packages and testing with my application.

-Sasikumar

gi.sasi
3 Dec 2010, 2:18 AM
Hello Condor,

I have compressed the ext-all.js with jsb2. I removed the packages which is not required by my application.
Thanks for you reply.

Thanks
Sasikumar

Yes you are correct it is doing only GZip compression. So only I now working with jsb2 by removing unnecessary packages and testing with my application.

-Sasikumar

blex2010
29 Dec 2010, 10:15 AM
So does jsb2 simply combine files? I ran it on two files as a test and it just concatenated them. I didn't see any compression?
Here is the command lineI used

java -jar JSBuilder2.jar -v --projectFile PlanSetup.jsb2 -d "C:\test"
Loading the 'PLAN_SETUP' Project
Loaded 1 Packages
Building the 'Plan Editor' package as 'bs_ps.js'
- There are 2 file include(s).
- - BS_PSHelpWindow.UI.js
- - BS_PSHelpWindow.js
Compressing output files...

And here is the config file


{
"projectName": "PLAN_SETUP",
"deployDir": ".",
"licenseText": "",
"pkgs": [
{
"name": "Plan Editor",
"file": "bs_ps.js",
"isDebug": false,
"fileIncludes": [
{
"text": "BS_PSHelpWindow.UI.js",
"path": ""
},
{
"text": "BS_PSHelpWindow.js",
"path": ""
}
],
"pkgDeps": [

],
"includeDeps": false
}
],
"resources":[

]
}

Condor
29 Dec 2010, 10:33 AM
There should be 2 files, an uncompressed bs_ps-debug and a minified bs_ps.

blex2010
29 Dec 2010, 11:56 AM
Ok, that gave me a clue. Notice in my exmaple above isDebug is false. You actually need isDebug:true or it never compresses.
Now I have two files.

HOWEVER the "compressed" file is not compressed. The spaces are gone but it still has normal symbols, etc. Here is what I see:

/*
*/
BS_PSHelpWindowUi=Ext.extend(Ext.Window,{title:"Help",width:400,height:400,modal:true,html:"<p><b>Plan Setup</b> - Lorem ipsum dolor...</p><br>",padding:5,autoScroll:true,autoDestroy:false,closeAction:"hide",initComponent:function(){BS_PSHelpWindowUi.superclass.initComponent.call(this)}});BS_PSHelpWindow=Ext.extend(BS_PSHelpWindowUi,{initComponent:function(){BS_PSHelpWindow.superclass.initComponent.call(this)}});Ext.reg("bspshelpwindow",BS_PSHelpWindow);

Condor
29 Dec 2010, 12:37 PM
That are all things that can't be compressed (all globally scoped variables).

Try compressing some actual code instead of only configurations.

blex2010
29 Dec 2010, 12:46 PM
Then what would be an example of something that would compress? Pretty much my entire application consists of objects. I tried this on classes with more code/methods in them but the result is the same.

blex2010
29 Dec 2010, 12:54 PM
Ok, I see what you mean. I assumed it would also condense the method or function names / not just the variables. So the only real issue I was having is turning isDebug off never generated the compressed version. Probably should rename or change behavior for that var :-)

Thank you

Condor
29 Dec 2010, 11:44 PM
The .jsb3 format (used by Ext 4 and Sencha Touch) is better in that aspect.

blex2010
30 Dec 2010, 8:18 AM
Great, looking forward to it!