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
Custom css URI functions are breaking #4644
Comments
@vjeux because |
I know it's fb-specific but would be great if we could :) Maybe do a more general heuristic like: name.endsWith('url') || name.endsWith('uri') instead of name === 'uri' |
Just add |
@vjeux can break many code using |
Sounds good, thanks for the pointer! |
@vjeux If it's possible to quote the URLs you can use that as a workaround. Prettier 1.13.4 --parser css Input: div {
background: -fb-datauri("/intern/images/org/product/default-image.png");
background: -fb-datauri("/intern/images/organization/product/default-image.png");
} Output: div {
background: -fb-datauri("/intern/images/org/product/default-image.png");
background: -fb-datauri(
"/intern/images/organization/product/default-image.png"
);
} |
Same problem #2835, try to fix both problem tommorow |
I had some internal discussions and the current regex also doesn't support "" nor \n inside. Right now there's only a 100 occurrences so it's not a huge deal. There's a new infra to extract those pieces from CSS that's in the work that will support " but it's likely going to take some time to release. I believe that we should find a way inside of prettier to not put a space after the / anyway, but in terms of priority it's pretty low and if we don't put any special handling inside of prettier we'll be fine, we can workaround on our end when it becomes an issue. |
@evilebottnawi Can you please explain this by some example? |
.a {
background: my-custom-scss-less-function-url('first_arg_is_not_url_but_can_have spaces and other strange-characters-+-*/');
} |
Gotcha! So, what's the potential solution? Should we have a static array of strings like |
@function url($arg) {
return 'url';
}
a {
background: url('same-other-strange-arg')
} But some limitation for css is normal |
@vjeux still relevant? Should we pursue this or are you fine using prettier ignore comments and closing this issue? |
@suchipi no, we should fix it, it is not easy, but possible |
I was gonna fix it really quick but didn't want to waste my time if it's not a problem for facebook anymore- vjeux indicated that they were changing the infra some around this |
We could put everything with |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
Fixed by #9966 |
Prettier 1.13.4
Playground link
Input:
Output:
This is not urgent but would be nice to find a way not to put a space after the first
/
. I remember that we are doing some custom things for urls, maybe we can whitelist everything that ends with url/uri as a heuristic?The text was updated successfully, but these errors were encountered: