ember-cli / broccoli-asset-rewrite

Broccoli plugin to rewrite a source tree from an asset map.
MIT License
10 stars 53 forks source link

doesn't handle multiple references to the same URL #39

Open bagby opened 8 years ago

bagby commented 8 years ago

Given the input

.sample-img-small   { width:  50px; height:  50px; background-image:url(/images/defs.svg#plus) }
.sample-img-medium  { width:  80px; height:  80px; background-image:url(/images/defs.svg#plus) }
.sample-img-large   { width: 120px; height: 120px; background-image:url(/images/defs.svg#plus) }
.sample-img-xlarge  { width: 240px; height: 240px; background-image:url(/images/defs.svg#plus) }

with options

{
  assetMap: {
    'images/defs.svg': 'assets/images/defs.svg'
  },
  prepend: 'https://cloudfront.net/'
}

Expected:

.sample-img-small   { width:  50px; height:  50px; background-image:url(https://cloudfront.net/assets/images/defs.svg#plus) }
.sample-img-medium  { width:  80px; height:  80px; background-image:url(https://cloudfront.net/assets/images/defs.svg#plus) }
.sample-img-large   { width: 120px; height: 120px; background-image:url(https://cloudfront.net/assets/images/defs.svg#plus) }
.sample-img-xlarge  { width: 240px; height: 240px; background-image:url(https://cloudfront.net/assets/images/defs.svg#plus) }

Actual:

.sample-img-small   { width:  50px; height:  50px; background-image:url(https://cloudfront.net/assets/assets/assets/assets/assets/assets/assets/assets/images/defs.svg#plus) }
.sample-img-medium  { width:  80px; height:  80px; background-image:url(https://cloudfront.net/assets/assets/assets/assets/assets/assets/assets/assets/images/defs.svg#plus) }
.sample-img-large   { width: 120px; height: 120px; background-image:url(https://cloudfront.net/assets/assets/assets/assets/assets/assets/assets/assets/images/defs.svg#plus) }
.sample-img-xlarge  { width: 240px; height: 240px; background-image:url(https://cloudfront.net/assets/assets/assets/assets/assets/assets/assets/assets/images/defs.svg#plus) }

(note the 8 nested assets folders)

I have a failing test, working on a PR now...

jamesarosen commented 1 year ago

What is customHash here? I don't see a fingerprint in the output, so I'm guessing you have customHash: null.