1. #1
    Sencha User
    Join Date
    Nov 2011
    Posts
    6
    Vote Rating
    0
    grumpus is on a distinguished road

      0  

    Default Sencha Cmd: Customize URLs of Ext sources during development

    Sencha Cmd: Customize URLs of Ext sources during development


    I generated an ExtJS application stub using Sencha Cmd and now I would like to set it up within a backend server for development. The ExtJS application will be served from within a path such as /static/project/ so I set up my script loading directives accordingly.

    Code:
        <script src="/static/project/ext/ext-dev.js" type="text/javascript" ></script>
        <script src="/static/project/bootstrap.js" type="text/javascript" ></script>
        <script src="/static/project/app/app.js" type="text/javascript" ></script>
    Now, when I try to load the application the loader stops on the first file with a 404 error on an address like this:

    http://server_url/ext/src/app/Application.js

    I want it to look for the sources in this location instead:

    http://server_url/static/project/ext/src/app/Application.js

    It seems that Ext expects its sources to be in a path relative to the page which called it. This is consistent with a Ext.Loader.addClassPathMappings command in bootstrap.js

    Code:
        /**
         * This file is generated by Sencha Cmd and should NOT be edited.  It is 
         * provided to support globbing requires, custom xtypes, and other 
         * metadata-driven class system features 
         */
        Ext.Loader.addClassPathMappings({
          "Ext": "ext/src",
          "Ext.rtl.EventObjectImpl": "ext/src/rtl/EventObject.js",
          "xmin": "app"
        });
    Sencha Cmd tells me NOT to edit this file, so I'm wondering how I can set the project up in such a way, that Sencha Cmd is able to find all files needed for building the application, while I'm still able to use the development version served from a custom URL.

    Which file do I edit to achieve this (sencha.cfg, app.json, etc)? What command do I call after editing them?

  2. #2
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    37,217
    Vote Rating
    859
    mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute

      0  

    Default


    You can try to edit in app.js to add your Ext.Loader.setPath to see how that works. You are just getting outside of what Cmd is aimed to work with.
    Mitchell Simoens @SenchaMitch
    Sencha Inc, Senior Forum Manager
    ________________
    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 in print!

    When posting code, please use BBCode's CODE tags.

  3. #3
    Sencha - Ext JS Dev Team dongryphon's Avatar
    Join Date
    Jul 2009
    Posts
    1,350
    Vote Rating
    134
    dongryphon is a name known to all dongryphon is a name known to all dongryphon is a name known to all dongryphon is a name known to all dongryphon is a name known to all dongryphon is a name known to all

      0  

    Default


    If you run this form does it get the paths correct:

    Code:
      sencha app refresh --base ..
    ?

    The "--base" argument can be used to specify the relative base of your page with respect to the Sencha Cmd application.

    We have an open ticket on this for 3.1.1 to respect this via configuration of the page file location but this might work for you in the interim.
    Don Griffin
    Ext JS Development Team Lead

    Check the docs. Learn how to (properly) report a framework issue and a Sencha Cmd issue

    "Use the source, Luke!"