-
24 Jan 2013 5:16 PM #1
How to build only application files leaving ext files in ext-all
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
Alex
-
26 Jan 2013 4:29 PM #2
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:
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).Code:<!-- <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> -->
To ensure that the framework comes before the legacy files, you can add something like this to the first one:
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.Code://@require Ext.grid.*
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 http://docs.sencha.com/ext-js/4-1/#!...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
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!"
Thank you for reporting this bug. We will make it our priority to review this report.


Reply With Quote