ember-cli / broccoli-asset-rev

Broccoli plugin to add fingerprint checksums and CDN URLs to your assets
MIT License
86 stars 83 forks source link

SVG files ignored on rewrite #33

Closed dmoreno closed 9 years ago

dmoreno commented 9 years ago

I have this configuration for fingerprint rewrite:

var app = new EmberApp(
{
  fingerprint:
  {
    extensions: [ 'js', 'css', 'png', 'jpg', 'gif', 'eot', 'svg', 'ttf', 'woff' ]
  },
  minifyCSS: {
    enabled: false
  }
} );

SVG file names are rewritten with hash. But inside css file, url for SVG webfont is not rewrited when it is generated by https://github.com/sapegin/grunt-webfont by this way:

Original CSS:

@font-face {
  font-family: "custom-font-icons";
  src: url("../icons/custom-font-icons.eot");
  src: url("../icons/custom-font-icons.eot?#iefix") format("embedded-opentype"), url("../icons/custom-font-icons.svg?#custom-font-icons") format("svg"), url("../icons/custom-font-icons.woff") format("woff"), url("../icons/custom-font-icons.ttf") format("truetype");
  font-weight: normal;
  font-style: normal;
}

Modified CSS:

@font-face{
  font-family:custom-font-icons;
  src:url(../icons/custom-font-icons-e7697bfc010f44efd8fc4bc56a5013a6.eot);
  src:url(../icons/custom-font-icons-e7697bfc010f44efd8fc4bc56a5013a6.eot?#iefix) format("embedded-opentype"),url(../icons/custom-font-icons.svg?#custom-font-icons) format("svg"),url(../icons/custom-font-icons-e4679169923a82666ab59d5ead50e370.woff) format("woff"),url(../icons/custom-font-icons-7ddb930e5b0a2155f6f38f92e16e7079.ttf) format("truetype");
  font-weight:400;
  font-style:normal
}

URL for SVG file is not rewritten with hash. Problem seems to be in this syntax:

url(../icons/custom-font-icons.svg?#custom-font-icons) format("svg")

But .eot files has the same sintax and they are rewritten.

rickharrison commented 9 years ago

Can you provide a sample project or a failing test case demonstrating the issue? We have a passing test that specifically uses that svg syntax and rewrites the source as expected.

rickharrison commented 9 years ago

Please make sure that you are on the latest version of broccoli-asset-rev and if possible on the latest version of ember-cli

dmoreno commented 9 years ago

You're right! I was using an old version of broccoli-asset-rev (0.3.1). If I update to 1.1.1 (dependency of last ember-cli version), it works like a charm!

Sorry for the noise! Thanks for your work, it's a useful project!

rickharrison commented 9 years ago

No worries, glad everything is working for you now!