-
18 Mar 2013 11:00 AM #1
Build with server generated JS
Build with server generated JS
Hello all,
I have a issue with Sencha Cmd.
In my app, I first load the framework, then I generate settings in JS format on server, and then my app launches with the settings retrieved from the server. See below:
app.json
Code:Code:{ "name": "Acente.mobi", "indexHtmlPath": "index.html", "url": null, "js": [ { "path": "touch/sencha-touch.js", "x-bootstrap": true }, { "path": "http://acente.local:8080/admin/gateway/index.php/settings/setting?mode=app", "remote": true }, { "path": "app.js", "bundle": true, "update": "delta" }, { "path": "http://maps.google.com/maps/api/js?sensor=true", "remote": true }, { "path": "resources/source/langs/tur.js" }, { "path": "lang.js", "update": "delta" }, ], "css": [ { "path": "resources/css/app.css", "update": "delta" } ], "appCache": { "cache": [ "index.html" ], "network": [ "*" ], "fallback": [] }, "resources": [ "resources/images", "resources/icons", "resources/startup" ], "ignore": [ ".svn$" ], "archivePath": "archive", "id": "a64ea987-ecb3-419b-9510-80134981238f" }
So, when I build this with Testing mode, app.js contains everything including the framework and my app files. And the remote "setting" is added as a <script/> tag into the index.html.
This breaks my application, because my app files make use of the settings on this remote script. Do you have any idea how to solve this issue? I cant see any way to interfere with the building process.
Maybe I should find another way in my app.js or in the initial controller to make my settings retrieved from the server usable for the app.
Any ideas?
-
20 Mar 2013 6:53 AM #2Sencha - Senior Forum Manager
- Join Date
- Mar 2007
- Location
- St. Louis, MO
- Posts
- 33,714
- Vote Rating
- 438
If you list this in app.json, it will attempt to find the file to copy, the remote option does not work in Cmd.
Mitchell Simoens @SenchaMitch
Sencha Inc, Senior Forum Manager
________________
http://www.JSONPLint.com - Source to lint your JSONP!
Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
https://github.com/mitchellsimoens
Think my support is good? Get more personalized support via a support subscription. https://www.sencha.com/store/
Need more help with your app? Hire Sencha Services services@sencha.com
Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is almost in print!
When posting code, please use BBCode's CODE tags.
-
20 Mar 2013 6:56 AM #3
But the file retrieved from the server (the setting JS) is not static. It is dynamic and has settings of the application. The client may change the settings at any time on the admin panel.
If I list it on app.json, I suppose it will get it once and put it statically on the app?
-
20 Mar 2013 7:02 AM #4Sencha - Senior Forum Manager
- Join Date
- Mar 2007
- Location
- St. Louis, MO
- Posts
- 33,714
- Vote Rating
- 438
Cmd doesn't run your application when you build it, it inspects the code. So if you are hitting a server side script like PHP it won't be run. You would need to edit index.html or you could use an index.php as your landing point that is just copied with the build but index.html will get edited by Cmd.
Mitchell Simoens @SenchaMitch
Sencha Inc, Senior Forum Manager
________________
http://www.JSONPLint.com - Source to lint your JSONP!
Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
https://github.com/mitchellsimoens
Think my support is good? Get more personalized support via a support subscription. https://www.sencha.com/store/
Need more help with your app? Hire Sencha Services services@sencha.com
Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is almost in print!
When posting code, please use BBCode's CODE tags.
-
20 Mar 2013 7:04 AM #5
I see. I should change the way I build settings for my app.
Thank you for replies,
Have a nice day.
Thank you for reporting this bug. We will make it our priority to review this report.


Reply With Quote