Dmitro
Dmitro

Reputation: 1549

How to avoid browser caching of assets/vendor.js?

I have Ember-CLI application and in index.html there is lines:

<link rel="stylesheet" href="assets/vendor.css">
<script src="assets/vendor.js"></script>

And browser caches this files. And I want to add ?v=:version-no, I want to do generation of version during execution of ember build.

How can I add this feature into ember build?

Upvotes: 0

Views: 1472

Answers (2)

Peadar
Peadar

Reputation: 459

Ember production builds come with fingerprinting enabled by default. If you want you can turn this on by setting it to true in your ember-cli-build.js file.

This will generate automatic fingerprints for you for test builds. This will add a fingerprint to file for you e.g.

<link rel="stylesheet" href="assets/vendor-1bcb3fe1589b69c2436b45465444058d.css">

Here is an example:

// ember-cli-build.js
var app = new EmberApp({
  fingerprint: {
    enabled: true
  }
});

You will find more help if you search for Ember fingerprinting. Here is a helpful page with some more details: http://ember-cli-deploy.com/docs/v0.4.x/fingerprinting-options-and-staging-environments/

Upvotes: 1

user1156168
user1156168

Reputation: 956

build application with ember build --environment=production

Upvotes: 3

Related Questions