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

Weird fingerprinting of images #43

Closed
mydea opened this issue Jan 9, 2017 · 1 comment
Closed

Weird fingerprinting of images #43

mydea opened this issue Jan 9, 2017 · 1 comment

Comments

@mydea
Copy link

mydea commented Jan 9, 2017

I'm not 100% sure if this belongs here, but I think so.

I'm using lazyLoading engines.
In one of the engines, I have the following image:

<img src="assets/images/test.png">

When building, I use fingerprinting and a CDN with the following configuration:

// host-app's ember-cli-build.js
// ...

var cdnPrepend = false;
if (env === 'staging') {
  cdnPrepend = 'https://XXX.cloudfront.net/';
}
if (env === 'production') {
  cdnPrepend = 'https://YYY.cloudfront.net/';
}

var app = new EmberApp(defaults, {
 fingerprint: {
      enabled: isProductionLikeBuild,
      prepend: cdnPrepend,
      extensions: ['js', 'css', 'png', 'jpg', 'gif', 'map', 'svg']
    },
   assetLoader: {
      generateURI: function(filePath) {
        if (cdnPrepend) {
          // Prevent duplicate slashes
          return cdnPrepend.substr(0, cdnPrepend.length - 1) + filePath;
        }
        return filePath;
      }
    }
});

I get the image

<img src="https://XXX.cloudfront.net/assets/engines-dist/my-engine-name/assets/images/test-FINGERPRINT.png">

So basically, it is weirdly duplication the assets portion to before the engines-dist, which makes this fail. I'm not quite sure where/how this comes from.

Also, not sure if this is related, but the url is also wrongly rewritten if I use /assets/xxx. Leaving the leading slash doesn't work in development for me, but in production it lead to /https://XXX.cloudfront.net/assets/engines-dist/my-engine-name/assets/images/test-FINGERPRINT.png, which of course also doesn't work.

If I set lazyLoading: false, it works as expected.

I'm using:
ember-engines@0.4.0
ember@2.10.2
ember-cli@2.10.0

@nathanhammond
Copy link
Contributor

This is an issue, likely not related to ember-asset-loader: ember-cli/ember-cli#6265 I'm closing this as it's being tracked upstream. broccoli-asset-rev needs some TLC (and an owner).

I'm appreciative of the additional information that you've provided here.

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

No branches or pull requests

2 participants