There are a few ways to do that, but I find adding gulp-rev build step the 
easiest to think about.

It's a build step, meaning it's done before you commit your changes and it 
gives you a hash of the file content. So if you change even a single character, 
you have a new hash for that file.

So how does that help? Well, include the hash on the filename, maybe just as a 
query string, for that resource.

E.g. You have file1.js, with hash asdf123, you include that file as 
src="file1-asdf123.js", or "file1.js?rev=asdf123". Now, the client will cache 
that for r. And if you change the file, it has a new hash, and therefore a new 
name, so the browser will fetch it again fresh.

There are other solutions similar to that, like using the file timestamp, gut 
hash num, manually bumping the number etc, but the mechanism is essentially the 
same. If bleeding edge is fine by you, you can also take a look at service 
workers, it's in all the headlines lately, but implemented in only a fraction 
of browsers. Similar to that, there are other ways to do this, but I don't 
think they're worth mentioning here or I don't know enough about them to 
comment.

As said, gulp-rev was always good enough for me.

-- 
Job board: http://jobs.nodejs.org/
New group rules: 
https://gist.github.com/othiym23/9886289#file-moderation-policy-md
Old group rules: 
https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
--- 
You received this message because you are subscribed to the Google Groups 
"nodejs" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/nodejs/70bfe330-8b98-425c-a026-3e79d1519dcf%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to