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

Support adding to the default fingerprinted extensions #117

Open
aprescott opened this issue Jul 7, 2017 · 2 comments
Open

Support adding to the default fingerprinted extensions #117

aprescott opened this issue Jul 7, 2017 · 2 comments

Comments

@aprescott
Copy link

  • ember-cli 2.13.0
  • broccoli-asset-rev 2.5.0

It looks like setting extensions: ["foo"] will override and replace and the default extensions configuration. There doesn't seem to be a configurable way of extending that list of default extensions.


When using fingerprintOptions via ember-cli, I noticed that "svg" isn't part of the default extension options, which was causing some discrepancies with url('/assets/images/.../foo.svg') vs url('/images/.../foo.svg') in CSS.

To fix that, I tried setting this configuration:

var app = new EmberApp(defaults, {
  fingerprint: {
    enabled: true,
    exclude: ['fonts'],
    extensions: ["svg"]
  },

  /* ... */
});

However, looking at the code, that seems to override and remove the default options, since options.extensions takes precedence over defaults.extensions.

Also, setting extensions: ["svg"] caused my app to not build correctly, for reasons I can't quite explain.

It would be great to be able to add to the default extensions list.

I worked around that manually like so:

var defaultFingerprintExtensions = require('broccoli-asset-rev/lib/default-options').extensions;

/* ... */

var app = new EmberApp(defaults, {
  fingerprint: {
    enabled: true,
    exclude: ['fonts'],
    extensions: defaultFingerprintExtensions.concat(["svg"])
  },

  /* ... */
});
@mirague
Copy link

mirague commented Jul 11, 2017

@aprescott I stumbled into the missing svg extension yesterday as well and observed interesting behaviour as well. How does your build process behave when passing in a complete new list of extensions? E.g.

extensions: ['js', 'css', 'png', 'jpg', 'gif', 'map', 'svg']

@aprescott
Copy link
Author

@mirague yep, that works fine, since it's the same as concating against the default. I wanted to avoid hard-coding the current set of defaults, which is why my work-around above uses concat.

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