Results 1 to 2 of 2

Thread: How to build only application files leaving ext files in ext-all

  1. #1
    Ext JS Premium Member
    Join Date
    May 2009
    Vote Rating

    Default How to build only application files leaving ext files in ext-all

    We have some legacy code which does not follow MVC at all (many classes in the same file, Ext.define, requires not used etc) we need to extend this application and want to use MVC for the new code and gradually refactor legacy code. Thus we need to be able to have a MVC compliant packaging of new code (consolidated file muct include individual classes in correct order) separate from Ext library code separate from legacy code so it can be included in following order

    - ext
    - legacy
    - new MVC compliant code

    I am new to cmd and could not figure out how to do it. I was reading compile docs and did not find any way to tell it to only include my application classes into the output file because I intend to use ext-all

    I would greatly appreciate your advise

  2. #2
    Sencha User dongryphon's Avatar
    Join Date
    Jul 2009
    Vote Rating


    Do you need these in separate concatenated outputs or would it suffice to get them in the right order and still have a single file?

    If the latter is workable for you, and if you can use the page compile command, here is a way to do it:

        <!-- <x-compile> -->
            <!-- <x-bootstrap> -->
                <script src="ext/ext-dev.js" type="text/javascript"></script>
            <!-- </x-bootstrap> -->
            <script src="legacy/foo.js" type="text/javascript"></script>
            <script src="legacy/bar.js" type="text/javascript"></script>
            <script src="app/app.js" type="text/javascript"></script>
        <!-- </x-compile> -->
    The above will tell the compiler about the legacy files and their order with respect to each other (the compiler will inject dependencies between each script tag to preserve this).

    To ensure that the framework comes before the legacy files, you can add something like this to the first one:

        //@require Ext.grid.*
    Or you can put that one line in a new script and place it before the first legacy file. If you need several such directives to declare what you need (vs "Ext.*") then the new file may be easy to reuse across pages.

    If you cannot use the page compile command, it will help to know how you currently handle load order of your legacy files.

    The low-level commands to do this kind of thing are discussed in!...mand_app_multi in the "Alternative Strategy - Sharing A Framework Subset" section. If you need to drop the page commands, you can still bring in the JS files by adding the folders to the classpath. That is mostly what the page command does behind the scenes (that and it performs the dependency scan / recursive union on the files directly used by the page but that is also achievable without the page command).
    Don Griffin

    "Use the source, Luke!"

Posting Permissions

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