Results 1 to 3 of 3

Thread: Shouldn't production build generate cache busters for scripts and resources automatc?

  1. #1
    Sencha Premium Member krause's Avatar
    Join Date
    Jun 2008
    Posts
    55

    Exclamation Shouldn't production build generate cache busters for scripts and resources automatc?

    I'm trying to package an app for production, but I have noticed that there are problems each time I roll out a new version, since the browser is (rightfully) caching app.js and MyApp-all.css.
    Shouldn't production profile generate cache busters for scripts and resources?
    Is there a simple solution that doesn't require hacking around (see workaround section)?

    Development Environment:
    Sencha Cmd v5.1.3.61
    ExtJS 4.2 (should be irrelevant)
    Ubuntu 14.04

    How to reproduce:
    sencha generate app -ext MyApp ./MyApp
    sencha app build -c production

    Result:
    build/production/MyApp/index.html contains:

    Code:
    <link rel="stylesheet" href="resources/MyApp-all.css"/>
    <script type="text/javascript" src="app.js"></script>
    Expected result:
    build/production/MyApp/index.html sould contain:

    Code:
    <link rel="stylesheet" href="resources/MyApp-all.css?_dc=1234"/>
    <script type="text/javascript" src="app.js?_dc=1234"></script>
    Workaround:
    add to build.xml:

    Code:
    <target name="-after-build">
        <replace file="${app.output.base}/index.html" token="${app.output.js}" value="${app.output.js}?v=${build.timestamp}" />
    </target>
    Related posts:
    https://www.sencha.com/forum/showthr...=1#post1092666

    https://www.sencha.com/forum/showthr...l=1#post932598
    Last edited by krause; 2 Oct 2015 at 9:40 AM. Reason: Changed title from "production profile" to "production build"

  2. #2
    Sencha - Sustaining Engineer tristan.lee's Avatar
    Join Date
    Mar 2015
    Location
    Central Ohio
    Posts
    1,579

    Default

    This is something that was given more control in later versions of the framework, but what you have done with the -after-build target is the recommended way to automate this.

    I don't really have an answer as to why it doesn't automatically do it other than maybe it was not preferred since it wasn't as easily controller like in later versions.
    Tristan Lee
    Sencha Inc - Sustaining Engineer


    Having an issue? Help us help you - be detailed; provide some code; demonstrate with a fiddle (fiddle.sencha.com)

    Embed your fiddle in your post: [FIDDLE]id[/FIDDLE]

  3. #3
    Sencha Premium User wemerson.januario's Avatar
    Join Date
    Nov 2008
    Location
    Goiânia - GO, Brazil
    Posts
    900

    Default

    Thanks for sharing works for Ext JS 4.2 apps
    Wemerson Januario @JanuarioCoder
    Novanti Tecnologia, Sencha MVP/ Ext JS Consultant
    ____________________________________________
    Hire me on UpWork:

    GitHub
    https://github.com/wemersonjanuario

    Treinamento e Consultoria Ext JS. QUALIFIQUE-SE JÁ!

Similar Threads

  1. Sencha Touch 2 - strange cache problem in scripts (??)
    By alexdran in forum Sencha Touch 2.x: Q&A
    Replies: 7
    Last Post: 23 Mar 2015, 5:55 AM
  2. Resources don't get Cache Busted
    By JK3jp5qMJwKW in forum Sencha Architect 3.x: Q&A
    Replies: 0
    Last Post: 4 Jun 2014, 10:05 AM
  3. Replies: 3
    Last Post: 26 Apr 2013, 5:49 AM
  4. Production build with cache.manifest does not cache images.
    By shwetapande10 in forum Sencha Touch 2.x: Q&A
    Replies: 3
    Last Post: 25 Jul 2012, 5:19 AM
  5. Rails 2.x cache for ext-js scripts
    By archian in forum Ext 2.x: Help & Discussion
    Replies: 1
    Last Post: 15 Jun 2009, 1:15 AM

Tags for this Thread

Posting Permissions

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