Results 1 to 5 of 5

Thread: Build with server generated JS

  1. #1
    Sencha User
    Join Date
    May 2011
    Posts
    25
    Vote Rating
    0
      0  

    Default 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?

  2. #2
    Sencha - Sr Software Engineer mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    39,551
    Vote Rating
    1271
      0  

    Default

    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 @LikelyMitch
    Sencha Inc, Senior Software Engineer
    ________________
    Learn BBCode and use it! Checkout the CODE tag!

    Check out my GitHub, lots of nice things for Ext JS and Sencha Touch
    https://github.com/mitchellsimoens

  3. #3
    Sencha User
    Join Date
    May 2011
    Posts
    25
    Vote Rating
    0
      0  

    Default

    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?

  4. #4
    Sencha - Sr Software Engineer mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    39,551
    Vote Rating
    1271
      0  

    Default

    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 @LikelyMitch
    Sencha Inc, Senior Software Engineer
    ________________
    Learn BBCode and use it! Checkout the CODE tag!

    Check out my GitHub, lots of nice things for Ext JS and Sencha Touch
    https://github.com/mitchellsimoens

  5. #5
    Sencha User
    Join Date
    May 2011
    Posts
    25
    Vote Rating
    0
      0  

    Default

    I see. I should change the way I build settings for my app.

    Thank you for replies,

    Have a nice day.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •