View Full Version : Help using SDK tools production build

12 Apr 2012, 10:11 AM
So I have dynamic loading working and a production build. Been reading on here and Jacky says not to modify index.html. We have a JSP that loads data used by the application so we can't use index.html.

So for development, index.html contains development.js and production contains generated inline JavaScript. So is it OK to trim down the base index.html to just this?

<script id="microloader" type="text/javascript" src="sdk/microloader/development.js"></script>

That way our JSP can import it while keeping the setup data?

The other issue I need to look into is development is at /mobile and production is at /mobile/builds/production

Jacky Nguyen
13 Apr 2012, 1:20 AM
Beside inlining the production microloader code, Sencha Command also:

1. Put in manifest="cache.manifest" attribute to the <html> tag to enable HTML 5 App Cache, so your app can work offline
2. Generate a checksum for index.html (since it's listed by default in the "cache" section of "appCache" inside app.json), and put that hash value inside cache.manifest. That way any changes made to index.html results in a different checksum value -> the browser will pull down the updated content the next time your app loads.

Therefore you have 2 choices:

1. Don't use HTML 5 App Cache at all if you don't care about your app working offline. Leaving just the script tag inside index.html is enough in this case.

2. Use HTML 5 App Cache. You will need to:

Output manifest="cache.manifest" for the <html> tag when the document is served in production mode. This should be trivial since you're already using a server-side script
Append a random comment line to cache.manifest whenever the HTML document output from the JSP page is changed. If you don't the client browser will never know that you have changes in the HTML document, and will stick with the previously cached version.
Take out "index.html" from "appCache" of app.json