1. #1
    Sencha Premium Member varsos's Avatar
    Join Date
    Feb 2008
    Location
    Long Island, NY
    Posts
    325
    Vote Rating
    10
    varsos is on a distinguished road

      0  

    Default How to add parameter to src="app.js" in my index.jsp

    How to add parameter to src="app.js" in my index.jsp


    Hi,

    Anyone know if there is a way to so this in my index.jsp:
    Code:
    <script type="text/javascript" src="app.js?_version=1234567890"></script>
    I get an error when building:
    Code:
    [ERR] C2000: Rhino Parse Error (unterminated string literal => ">)
    I guess because of the extra text after app.js and without it the build succeeds.

    I would appreciate any ideas.

    Thanks
    varsos

  2. #2
    Sencha Premium Member varsos's Avatar
    Join Date
    Feb 2008
    Location
    Long Island, NY
    Posts
    325
    Vote Rating
    10
    varsos is on a distinguished road

      0  

    Default


    Also, any ideas on how to end up with the production version like this:
    Code:
    <script type="text/javascript" src="all-classes.js?_version=1234567890"></script>
    would be appreciated.

    thanks
    varsos

  3. #3
    Ext JS Premium Member burnnat's Avatar
    Join Date
    Jun 2011
    Posts
    410
    Vote Rating
    55
    burnnat is a jewel in the rough burnnat is a jewel in the rough burnnat is a jewel in the rough burnnat is a jewel in the rough

      0  

    Default


    One solution would be to inject the URL parameters through Sencha Cmd's integration with Ant - I'm using a similar approach to adjust paths in my compiled page. In your build file, you can add a "-before-page" target that removes the parameter from the page before compiling, and an "-after-page" target that injects the parameter back into the built version. You could use Ant's basic string/regex replacement to make the modifications, or you can implement a more robust approach if you're so inclined (maybe some Java code in a custom Ant task...?).

  4. #4
    Sencha Premium Member varsos's Avatar
    Join Date
    Feb 2008
    Location
    Long Island, NY
    Posts
    325
    Vote Rating
    10
    varsos is on a distinguished road

      0  

    Default A good solution

    A good solution


    A good solution is described in this thread:
    http://www.sencha.com/forum/showthread.php?254775
    using the -before-init to alter the build.classes.name property.
    varsos

  5. #5
    Sencha Premium Member varsos's Avatar
    Join Date
    Feb 2008
    Location
    Long Island, NY
    Posts
    325
    Vote Rating
    10
    varsos is on a distinguished road

      1  

    Default better solution

    better solution


    That solution using the -before-init does not work, because although the compile command changes the index.jsp the concat command fails, Yui compressor doe snot find the file.

    This solution works for me:
    Code:
        <target name="-after-page">
            <tstamp>
                <format property="tstamp.full" pattern="yyyyMMddHHmmss"/>
            </tstamp>
            <replace file="${build.dir}/${app.page.name}" token="${build.classes.name}" value="${build.classes.name}?version=${tstamp.full}"/>
            <replace file="${build.dir}/${app.page.name}" token="${app.out.css.rel}" value="${app.out.css.rel}?version=${tstamp.full}"/>
        </target>
    It touches the index.jsp after page command is done.
    The weakness is that it uses properties that are not exposed in build.properties and can change with newer version of Cmd
    varsos

Thread Participants: 1

film izle

hd film izle

film sitesi

takipci kazanma sitesi

takipci kazanma sitesi

güzel olan herşey

takipci alma sitesi

komik eğlenceli videolar