Results 1 to 5 of 5

Thread: Include extra scripts in Ext JS build

  1. #1
    Sencha Premium Member StuartAshworth's Avatar
    Join Date
    Feb 2009
    Location
    Glasgow, Scotland
    Posts
    414
    Vote Rating
    42
      1  

    Default Include extra scripts in Ext JS build

    Hi

    I'm trying to use Sencha Cmd to build an Ext JS 4.1.1a application that uses a third party script (non-Ext) which I have included in the index.html - all works well in this dev environment.

    However, when I try to build with Sencha Cmd 3.0.2.288 I need a way to include these extra scripts in the process so they are copied to the output directory.

    In a Sencha Touch app you would include these in the app.json file but I'm not sure what the equivalent is for Ext JS?

    The "built" index.html includes the references to the files but they are not copied over.

    Any pointers would be appreciated!

    Cheers
    Stuart
    SenchaTalk.com - a free Slack community for all things Sencha. Join Now!

    Learn Ext JS 6 with my new ebook - Ext JS 6: Getting Started. Get a Sample Chapter now!

    Need help with Sencha development, code reviews or training? Get in touch!

    stuart@stuartashworth.com
    @StuartAshworth9

  2. #2
    Sencha User mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    40,026
    Vote Rating
    1367
      1  

    Default

    This is simple to do; all that's needed is to choose the appropriate target in build.xml. For this example, we'll hook into the -after-page build target to minify the 3rd-party script. Place the following into your project root node in build.xml:

    Code:
    <property name="common.dir" location="common"/>
    
    <target name="-after-page">
        <x-sencha-command>
            fs
            minify
                --from=${common.dir}/in.js
                --to=${common.dir}/out.js
                --compressor=closurecompiler
        </x-sencha-command>
    </target>
    Note that it's also possible to define the common.dir property in the ./.sencha/app/sencha.cfg file:

    Code:
    app.name=MyApp
    app.framework=ext
    app.classpath=${app.dir}/app
    
    common.dir=common
    
    app.cmd.version=3.0.2.288
    And here we'll combine the two operations into one:

    Code:
    <target name="-after-page">
        <x-sencha-command>
            fs
            minify
                --from=${common.dir}/in.js
                --to=${common.dir}/out.js
                --compressor=closurecompiler
            and
            concatenate
                --from=${build.dir}/all-classes.js,${common.dir}/out.js
                --to=${build.dir}/final-build.js
        </x-sencha-command>
    </target>
    Mitchell Simoens @LikelyMitch
    Modus Create, Senior Frontend Engineer
    ________________
    Need any sort of Ext JS help? Modus Create is here to help!

    Check out my GitHub:
    https://github.com/mitchellsimoens

  3. #3
    Sencha User mono blaine's Avatar
    Join Date
    Jul 2008
    Location
    Turkey
    Posts
    123
    Vote Rating
    8
      0  

    Default

    Is there any way to overwrite or delete a previously concatenated file just before the "fs concatenate" command is executed? An additional argument, maybe? Docs won't help.

  4. #4
    Sencha User mono blaine's Avatar
    Join Date
    Jul 2008
    Location
    Turkey
    Posts
    123
    Vote Rating
    8
      0  

    Default

    OK, found it. We could just use ant stuff within <target name="-after-page">:

    Code:
    <delete file="${path.to.some.file}"/>

  5. #5
    Sencha Premium Member StuartAshworth's Avatar
    Join Date
    Feb 2009
    Location
    Glasgow, Scotland
    Posts
    414
    Vote Rating
    42
      0  

    Default

    Thanks for the reply Mitchell, that got things sorted.

    Cheers
    Stuart
    SenchaTalk.com - a free Slack community for all things Sencha. Join Now!

    Learn Ext JS 6 with my new ebook - Ext JS 6: Getting Started. Get a Sample Chapter now!

    Need help with Sencha development, code reviews or training? Get in touch!

    stuart@stuartashworth.com
    @StuartAshworth9

Posting Permissions

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