1. #1
    Sencha Premium Member robert_k's Avatar
    Join Date
    Jun 2012
    Posts
    35
    Vote Rating
    1
    robert_k is on a distinguished road

      0  

    Default How to strip all comments from the testing build?

    How to strip all comments from the testing build?


    I noticed that my testing build app.js file is 1.9Mb, and in the interest of saving bandwidth and loading time I want to strip comments during the build process. I know I can do this with uglifyjs, but how would I integrate this as part of the compilation process?

  2. #2
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    36,754
    Vote Rating
    828
    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 create a plugin to hook into the build process
    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 Premium Member robert_k's Avatar
    Join Date
    Jun 2012
    Posts
    35
    Vote Rating
    1
    robert_k is on a distinguished road

      0  

    Default


    Mitchell, that much is obvious. What isn't obvious is how to actually accomplish what I'm after. I've never used Ant in my life, and find Sencha Cmd to be undocumented (and therefore hard to extend).

  4. #4
    Sencha - Ext JS Dev Team dongryphon's Avatar
    Join Date
    Jul 2009
    Posts
    1,335
    Vote Rating
    130
    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


    You didn't mention which framework you are using and there are some differences in the details there, but maybe something like this in your app's build.xml would work:

    Code:
        <target name="-after-build">
            <x-strip-js srcfile="${build.page.file}" outfile="${build.page.file}"/>
        </target>
    To see the properties in use (and hence things you can control) check out .sencha/app/build-impl.xml.

    The "-after-build" target is called on the end of "sencha app build" so you can fine tune the results there as needed.

    See also http://docs-devel.sencha.com/ext-js/...de/command_ant

    For general Ant tasks, see http://ant.apache.org/manual/index.html

    If this needs to be only done in testing builds (since x-strip-js may not like the compressed output), you can do this:

    Code:
        <target name="-after-build">
            <if>
                <equals arg1="${args.environment}" arg2="testing"/>
                <then>
                    <x-strip-js srcfile="${build.page.file}" outfile="${build.page.file}"/>
                </then>
            </if>
        </target>
    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!"

  5. #5
    Sencha Premium Member robert_k's Avatar
    Join Date
    Jun 2012
    Posts
    35
    Vote Rating
    1
    robert_k is on a distinguished road

      0  

    Default


    You're right, I did forget to mention that I'm using Sencha Touch 2.1.1 with Sencha Cmd 3.0.2.288.

    The code you gave throws an error in ST2.1.1/Cmd3.0.2:

    Code:
    [ERR]        BUILD FAILED
    [ERR]        java.lang.RuntimeException: $'{'build.page.file'}' (No such file or directory)
    I switched the definition to:

    Code:
        <target name="-after-build">
            <if>
                <equals arg1="${args.environment}" arg2="testing"/>
                <then>
                    <x-strip-js srcfile="${build.dir}/testing/app.js" outfile="${build.dir}/testing/app.js"/>
                </then>
            </if>
        </target>
    I edited because I found a solution. Seems like just listing the source/output as "app.js" won't tell Ant where to find the file.
    Last edited by robert_k; 22 Mar 2013 at 5:59 AM. Reason: Found a working solution...

  6. #6
    Sencha - Ext JS Dev Team dongryphon's Avatar
    Join Date
    Jul 2009
    Posts
    1,335
    Vote Rating
    130
    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


    I think I missed some properties on x-strip-js sorry. Try this:

    Code:
       <x-strip-js srcfile="${build.dir}/testing/app.js"
            outfile="${build.dir}/testing/app.js"
            blockcomments="true"
            linecomments="true"
            keepfirstcomment="true"/>
    You can adjust those three attributes to suite your needs.
    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!"

Thread Participants: 2

Turkiyenin en sevilen filmlerinin yer aldigi xnxx internet sitemiz olan ve porn sex tarzi bir site olan mobil porno izle sitemiz gercekten dillere destan bir durumda herkesin sevdigi bir site olarak tarihe gececege benziyor. Sitenin en belirgin ozelliklerinden birisi de Turkiyede gercekten kaliteli ve muntazam, duzenli porno izle siteleri olmamasidir. Bu yuzden iste. Ayrica en net goruntu kalitesine sahip adresinde yayinlanmaktadir. Mesela diğer sitelerimizden bahsedecek olursak, en iyi hd porno video arşivine sahip bir siteyiz. "The Best anal porn videos and slut anus, big asses movies set..." hd porno faketaxi