Skip to content
This repository was archived by the owner on Jun 14, 2019. It is now read-only.
This repository was archived by the owner on Jun 14, 2019. It is now read-only.

Only first resource gets replaced. #18

@nawlbergs

Description

@nawlbergs

Im trying to switch from grunt to gulp... this library is very close to what I need... but apparently if you have two identical file references... only the first one will get busted in a particular page.

<script type="text/javascript">
    window.no_cache  = "client/static/js/app.js?v=thisfilegotbustedabc123";  // gets busted
</script>
<script src="client/static/js/app.js"></script>  // <!-- not busted -->

why would I do this? My project passing the md5 of the main js file and is basically using it as a Version number... (among other things). Then in my app.... I use it for additional cachebusting.. like certain ajax requests:

  // ajax httpInterceptor .. 
  // ... some code to get md5 hash etc...
  request.url = request.url + symbol + 'no_cache='+md5;

Maybe I'm doing things unlike most people... but I'm trying to keep the project simple, and implement
a basic level of cache-busting. I've looked at other setups and other options that include things like re-naming files and resources.. that just seems like overkill.

I noticed your using cheerio to loop the dom... but doing a non-global replace... so each element only replaces the first resource found.

Even if you don't want to do a global replace.. this is a bug as its finding a <script src=".."> but busting it somewhere else...

Thoughts...
Thanks.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions