samedi 25 octobre 2014

[Ext 5.0.1] sencha compile and compress

Hi everybody,

I am using the java Play! framework 1.2 with extjs 5 for my project.
I want to compress all of my extjs components files into one.


I put all of my components's files in the /public/javascripts/app/app folder.

I start my application app.js with ' Ext.onReady' function.

I succeed to minify my javascript with the following sencha cmd :



Code:



sencha compile --classpath=../ext-5.0.1/src,../app/app
--options=debug:false
include --all
and concatenate --compress
--output-file=output.js


But, to make it run, i have to remove the following code from "output.js" :

Code:



Ext.define("Ext.ux.google.Feeds",{extend:Ext.ux.google.Api,requiresGoogle:{api:"feeds",nocss:true}});


Because if i keep it, I get this error in firebug:

TypeError: Ext.ux.google is undefined

When it works, firefox load the application very slowly, is there something i do wrong ?

I think i have too much code in output.js, is my sencha cmd wrong ?


Here is my main.html file (loaded by my play! java framework and where i put all my javascripts files manually until now)



Code:



<html>
<title>MyProject</title>
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<link rel="stylesheet" type="text/css" href="@{'/public/javascripts/ext-5.0.1/packages/ext-theme-crisp/build/resources/ext-theme-crisp-all-debug.css'}">
<link rel="stylesheet‡" type="text/css" href="@{'/public/javascripts/app/sass/src/view/Main.scss'}">
<link rel="stylesheet" type="text/css" href="@{'/public/stylesheets/main.css'}">
<script type="text/javascript" src="@{'/public/javascripts/app/output.js'}"></script>
<script type="text/javascript" src="@{'/public/javascripts/app/app.js'}"></script>
<body> </body> </html>

Then, i change the sencha compile command (without the extjs5 src folder):


Code:



sencha compile --classpath=../app/app
--options=debug:false
include --all and concatenate --compress
--output-file=outputComponents.js

And it works when i still remove this code:

Code:



Ext.define("Ext.ux.google.Feeds",{extend:Ext.ux.google.Api,requiresGoogle:{api:"feeds",nocss:true}});


The minified file outputComponents.js seems smaller (2Mb) than the previous output.js (3.2Mb). But it always contains class that i don't use

Is somebody can help me with the commands i did ?

Thanks


Pierre






[Ext 5.0.1] sencha compile and compress

Aucun commentaire:

Enregistrer un commentaire