2014-07-24 71 views
3

我已經使用sencha cmd構建了extjs 5應用程序,我想在自定義hmtl頁面中使用它。 我有以下結構:使用extjs應用程序文件夾外部的bootstrap.js加載extjs

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

我想要做的就是在我的customapp/index.html的我請求bootstrap.js,它應該載入從extjsapp夾中的所有包和分機。默認情況下,它會嘗試從customapp/ext中加載它們,這與使用boostrap.js的地方相關。我該如何構建/構建它,以便從extjsapp/ext而不是customapp/ext中加載ext。

應該可以從任何位置使用bootstrap.js來加載extjs框架以及構建在extjs文件夾中的所有必需軟件包。

回答

2

app.json文件中,您將看到有關類路徑的條目。這用來告訴Sencha Cmd你的源文件在哪裏。

同樣在該文件中,您將看到有關indexHtmlPath的條目。這說明index.html文件的位置。

/** 
* 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", 

更改ExtJS庫的位置涉及編輯隱藏文件 - .sencha/app/sencha.cfg。那裏有一個物業 - ext.dir - 你需要改變。

+0

我發現.sencha/workspace/sencha.cfg中的屬性不在.sencha/app/sencha.cfg中。改變它的工作方式,但它需要相對路徑。試試你自己。如果我將其更改爲/ extjsapp/ext,它仍然會在bootstrap.json中分機 – Jamol

+0

是的;它在'.sencha/app'中,如果你有一個單一的應用程序項目,在'.sencha/workspace'中如果你使用了工作區。 –