3
votes

I have built extjs 5 app using sencha cmd and I want to use it in my custom hmtl page. I have the following structure:

extjsapp
    .sencha
    app
    build
    ext
    packages
    ......
    bootstrap.js
    bootstrap.json
    app.js
    .......
customapp
    index.html
    script.js

What I want to do is in my customapp/index.html I request bootstrap.js and it should load all packages and ext from extjsapp folder. By default it tries to load them from customapp/ext which is relative to where boostrap.js is used. How can I make/build it so that it will load ext from extjsapp/ext instead of customapp/ext.

It should be possible to use bootstrap.js from any location to load extjs framework and all required packages that are built in extjs folder.

1

1 Answers

2
votes

In the app.json file, you'll see an entry about the classpath. This is used to tell Sencha Cmd where your source files are.

Also in that file, you'll see an entry about the indexHtmlPath. This says where the index.html file is.

/**
 * Comma-separated string with the paths of directories or files to search. Any classes
 * declared in these locations will be available in your class "requires" or in calls
 * to "Ext.require". The "app.dir" variable below is expanded to the path where the
 * application resides (the same folder in which this file is located).
 */
"classpath": "${app.dir}/app",
...
/**
 * The file path to this application's front HTML document. This is relative
 * to this app.json file.
 */
"indexHtmlPath": "index.html",

Changing where the ExtJS library is involves editing a hidden file - .sencha/app/sencha.cfg. There's a property in there - ext.dir - that you need to change.