Wednesday 10 April 2013

How to set Local Library Path in Sencha Architect 2

For any Sencha Touch Projects, app.html/index.html acts as a entry point for your application. This html file will load the required Sencha Touch library files (sencha-touch-all.js, sencha-touch.css) from the internet. If you don't have internet connection or your internet connection lost, loading these library files will fails. This will impact your development.

Today we are going to see, how we can move these two Sencha Touch library files locally into the project folder.

In app.html file, these below two library URL's are getting loaded from the internet.

http://extjs.cachefly.net/touch/sencha-touch-2.1.0/sencha-touch-all.js
http://extjs.cachefly.net/touch/sencha-touch-2.1.0/resources/css/sencha-touch.css

First, inside Project root folder, let's create resources folder (<project root folder>/resources). Inside resources folder, please create css folder (<project root folder>/resources/css).

Now, let's access the first URL- http://extjs.cachefly.net/touch/sencha-touch-2.1.0/sencha-touch-all.js in any web browser and save its content under Project root folder by Right-Clicking and select 'Save As' Option.

Then access the second URL- http://extjs.cachefly.net/touch/sencha-touch-2.1.0/resources/css/sencha-touch.css and save its content under <project root folder>/resources/css  by Right-Clicking and select 'Save As' Option.

Lets move to Sencha Architect and click library option under Resources in Project Inspector Section. This will open the config window similar to below one.


In Library Base Path Config Property, replace the default value 'http://extjs.cachefly.net/touch/sencha-touch-2.1.0/'  with '/<project root folder>/' and click save. This will save your Project.

Now, if you see app.html file, library URL's path will now reflect as

/<project root folder>/sencha-touch-all.js
/<project root folder>/resources/css/sencha-touch.css

That's it. we have successfully done with local library path settings in Sencha Architect 2. Hope, you enjoyed this Post.

No comments:

Post a Comment