2014-07-24 66 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'中如果你使用了工作区。 –