Skip to content

Conversation

@jakubrohleder
Copy link
Contributor

When url-loader is used with limit option some of images are encoded to base64 data url, this fix prevent such links from being prefixed.

It also makes link prefixing safer by using path.join instead of string concatenation.

@KyleAMathews
Copy link
Contributor

Oh interesting! Wouldn't have thought of this problem. Thanks for the PR!

Two request — could you break up the code into individual if statements and document each. I don't think it'd occur to many people reading the code why a link would be a data url. Second, how big is the path module? As this function gets loaded into every Gatsby site, we should keep this as small as possible so if there's a more focused "path join" module then we should use that.

@KyleAMathews KyleAMathews merged commit ecca692 into gatsbyjs:master Jul 5, 2016
KyleAMathews added a commit that referenced this pull request Jul 5, 2016
@KyleAMathews
Copy link
Contributor

I ended up not using path.join as it added 2kb extra code after minification. I'd rather we just add more invariants as needed to teach people how to form their path prefix as that's more effective plus doesn't add any needless code weight.

@jakubrohleder
Copy link
Contributor Author

@KyleAMathews Thanks for finishing my PRs. I had really busy time recently :)

@KyleAMathews
Copy link
Contributor

No worries :-) thanks for starting it!
On Jul 10, 2016 4:40 AM, "Jakub Rohleder" [email protected] wrote:

@KyleAMathews https://github.com/KyleAMathews Thanks for finishing my
PRs. I had really busy time recently :)


You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
#325 (comment), or mute
the thread
https://github.com/notifications/unsubscribe/AAEVh_V-K8CTLDYyS9E4QzjNWbsLYGyxks5qUNojgaJpZM4Izh8Z
.

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.

2 participants