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

Fix prepend option in srcset attributes #61

Closed
wants to merge 2 commits into from
Closed

Fix prepend option in srcset attributes #61

wants to merge 2 commits into from

Conversation

Serabe
Copy link

@Serabe Serabe commented Oct 5, 2017

The problem in ember-cli/broccoli-asset-rev#48 happened because
the logic to avoid prepending assets twice did not take into account
the edge case of srcset, where there are many assets in one match.

This edge case complicates things more than a bit. To simplify the
solution, when a prepend option is found, we use a replacer function
as second parameter.

Closes ember-cli/broccoli-asset-rev#48
Closes #51

The problem in ember-cli/broccoli-asset-rev#48 happened because
the logic to avoid prepending assets twice did not take into account
the edge case of srcset, where there are many assets in one match.

This edge case complicates things more than a bit. To simplify the
solution, when a prepend option is found, we use a replacer function
as second parameter.

Closes ember-cli/broccoli-asset-rev#48
/*
* Checks if there is already a prepend in the current match.
*/
function alreadyHasPrepend(string, prepend, offset, submatch) {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

perhaps use function alreadyHasPrepend(string, prepend, offset, submatch = '') { to avoid ugly (submatch || "").length

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wish. Is node >= 0.10 :(

@rwjblue
Copy link
Member

rwjblue commented Oct 6, 2017

Seems reasonable to me, but I'm unsure how to gauge the potential side effects...

@cibernox
Copy link

cibernox commented Oct 6, 2017

On that regard, I think we could merge this and also bump the minimum node version, and then use that as an excuse for bumping the mayor version.
Then broccoli-asset-rev can get a new version that depends on ^2.0.0 of this, and if there is any problem people can pin to the previous version.
broccoli-asset-rev could get a major version too, as it would be implicitly dropping support for old node.

@lifeart
Copy link

lifeart commented Dec 27, 2017

@cibernox @rwjblue any progress with pr merge?

@Serabe
Copy link
Author

Serabe commented May 8, 2018

@rwjblue ping on this.

@Serabe
Copy link
Author

Serabe commented Jun 25, 2018

@rwjblue dockyard.com is using this fix in production without any problem. Can this land?

@brzpegasus
Copy link

To be more specific, we used a fork of broccoli-asset-rewrite that contains this change and have used it on https://dockyard.com/careers to support multiple image sources:

screen shot 2018-06-25 at 3 22 37 pm

We haven't seen any issue with it and are planning on using srcset on additional pages in the future thanks to this fix.

@Serabe
Copy link
Author

Serabe commented Jul 20, 2018

Ping.

@Serabe
Copy link
Author

Serabe commented Sep 6, 2018

@rwjblue anything I can do to get this merged?

Thank you!

@cibernox
Copy link

We're about to start using sourcesets in production and we will need to prepend the bucket's url, so we also need this fix.

@lifeart
Copy link

lifeart commented Sep 24, 2018

@rickharrison can you help us?

@rickharrison
Copy link
Collaborator

Would anyone be interested in becoming a maintainer of this project? I am unable to test this change at the moment due to overwhelming obligations at work.

@Serabe
Copy link
Author

Serabe commented Sep 24, 2018 via email

@Serabe
Copy link
Author

Serabe commented Oct 21, 2018

@rickharrison is your offer still valid? I can be a maintainer for this project, can take broccoli-asset-rev too, as they are quite related if you want.

Thank you!

@Serabe
Copy link
Author

Serabe commented Nov 15, 2019

Closing this.

@Serabe Serabe closed this Nov 15, 2019
@lifeart
Copy link

lifeart commented Nov 15, 2019

Nooo

@GCheung55
Copy link

@Serabe @rickharrison can this issue be revived/reopened?

@Serabe
Copy link
Author

Serabe commented Jun 8, 2020

I tried over two years to get this merged. I'm not interested on further trying unless any of the maintainers show any kind of intention to help moving this forward.

@lifeart
Copy link

lifeart commented Jun 9, 2020

@rickharrison, is it possible to transfer repo to https://github.com/broccolijs org?

cc: @rwjblue, @cibernox, @cibernox

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.

Fingerprinting for srcset not working Srcset problems
7 participants