Arkady Rodestve
Arkady Rodestve

Reputation: 147

Compressing extJS code (only components that i trully need)

A long time ago i saw on www.sencha.com utility (or whatever this was, i dont remember).

This utility can compress those components that i need (for example datepickers, diagrams and so on) and ext-all.js can be less than 1mb.

And i need to do it, but how?

Thank you!

Upvotes: 2

Views: 2551

Answers (2)

escrubalo
escrubalo

Reputation: 338

Download Sencha SDK Tools and install it.

Run the following commands in your index directory:

sencha create jsb -a index.html  -p site.jsb3
sencha build -p site.jsb3 -d .

This will create app-all.js with only the classes that your index file requires to run.

Finally create a new index that uses the generated app-all.js:

<html>
    <head>
      <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
      <link rel="stylesheet" type="text/css" href="ext/resources/css/ext-all.css" />
              <script type="text/javascript" src="ext/ext.js"></script>
      <script type="text/javascript" src="app-all.js"></script>
      <title>Your Title</title>
    </head>
    <body>
    </body>
</html>

You still need to load the core ext.js.

Upvotes: 3

Li0liQ
Li0liQ

Reputation: 11264

You are talking about jsbuilder. They are still supporting it.

The utility uses .jsb2 file to configure the elements to include in resulting package and YUI Compressor to minimize it.

Upvotes: 3

Related Questions