Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow passing customHash in fingerprint options #1024

Merged
merged 1 commit into from
Jun 20, 2014
Merged

Allow passing customHash in fingerprint options #1024

merged 1 commit into from
Jun 20, 2014

Conversation

chnn
Copy link
Contributor

@chnn chnn commented Jun 13, 2014

This adds a customHash option that can be passed to the fingerprint configuration:

var app = new EmberApp({
  fingerprint: {
    enabled: true,
    customHash: 'custom123'
  }
});

The result is that fingerprinted files will use the customHash string instead of a MD5 hash of the file. (e.g. "assets/vendor-5429f75166356b28c3e42dd401abaf36.js" becomes "assets/vendor-custom123.js").

The motivation behind this is that it's difficult to get the names of fingerprinted files if you aren't using the ember-cli generated dist/index.html file. By using customHash, you can set the fingerprint to be something like the current commit's SHA if you are working in a git repo or a version number from a package.json file. Those are easier to predict and setup in a non ember-cli generated index.html template elsewhere.

It relies on some new functionality released in broccoli-asset-rev 0.0.6.

@chnn
Copy link
Contributor Author

chnn commented Jun 17, 2014

anyone?

@stefanpenner
Copy link
Contributor

@Chenn can you rebase? Also, we are working hard on a proper plugin api with configuration. Some progress has been made, hopefully with you input we can move this to that.

@chnn
Copy link
Contributor Author

chnn commented Jun 17, 2014

rebase into master? I already squashed the commits.

I'd be happy to take a stab at moving the whole fingerprinting functionality to a plugin. Would that be preferred to this?

@stefanpenner
Copy link
Contributor

@Chenn rebase to master, as it no longer merges cleanly

@chnn
Copy link
Contributor Author

chnn commented Jun 17, 2014

ok, should merge cleanly now.

@stefanpenner
Copy link
Contributor

no longer merges cleanly.

@chnn
Copy link
Contributor Author

chnn commented Jun 20, 2014

@stefanpenner it should now.

stefanpenner added a commit that referenced this pull request Jun 20, 2014
Allow passing customHash in fingerprint options
@stefanpenner stefanpenner merged commit c0d6fcc into ember-cli:master Jun 20, 2014
@raycohen
Copy link
Contributor

let's get this handy feature documented in http://www.ember-cli.com/user-guide/#fingerprinting-and-cdn-urls

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants