-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
css modules: use a terser selector format that requires less escaping #3437
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
9 Ignored Deployments
|
Benchmark for 6f304eeClick to view benchmark
|
b18df50
to
81a23e4
Compare
🟢 CI successful 🟢Thanks |
@@ -31,3 +31,8 @@ turbopack-env = { path = "../turbopack-env" } | |||
|
|||
[build-dependencies] | |||
turbo-tasks-build = { path = "../turbo-tasks-build" } | |||
|
|||
[features] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added this section so cargo test -p turbopack-tests
is possible. cc @kwonoj
Benchmark for ba33241Click to view benchmark
|
075a54c
to
0a13e5c
Compare
Benchmark for 81c90e8
Click to view full benchmark
|
0a13e5c
to
242196a
Compare
Benchmark for 42ba4a0Click to view benchmark
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
next uses filename_class__hash
, haven't checked node_modules
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't like this change. Before it was obvious from a class name from which source file it comes from. Now this is no longer the case.
I don't see the benefit of reading generated code, since the user will never read it anyway. It's source mapped and links to the source will point to the original css. Instead they might read the html or Dom where escaping is not required.
But I see the escaping problem on front. How about using the current content but converting it to a escape free format e.g. by using underscores, or using our magic identifier encoding
@sokra readability of the classes in the HTML tree is terrible when there are multiple classes applied to one element maybe we can add some configuration |
I agree with making the change to a smaller classname.
The users see generated code in the DOM tree. Having such long classnames is overwhelming. And the ability to associate a classname with the file is still there, you just need to click the classname int the style panel to open up the defining file. |
#3437 wasn't up to date with main when it was merged. Test Plan: CI
#3437 wasn't up to date with main when it was merged. Test Plan: CI
…49736102+kodiakhq[bot]@users.noreply.github.com> # New Features - vercel/turbo#3540 - vercel/turbo#3549 - vercel/turbo#3465 - vercel/turbo#3550 - vercel/turbo#3495 - vercel/turbo#3624 - vercel/turbo#3600 - vercel/turbo#3676 - vercel/turbo#3689 # Fixes - vercel/turbo#3437 - vercel/turbo#3542 - vercel/turbo#3531 - vercel/turbo#3552 - vercel/turbo#3551 - vercel/turbo#3597 - vercel/turbo#3644 - vercel/turbo#3623 - vercel/turbo#3634 - vercel/turbo#3574 - vercel/turbo#3673 - vercel/turbo#3675 - vercel/turbo#3723 - vercel/turbo#3677 - vercel/turbo#3717 - vercel/turbo#3701 # Performance Improvements - vercel/turbo#3361 - vercel/turbo#3619 --------- Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
Turbopack uses a different format for its css module classnames [0]. This adds and uses a helper function to the next-font tests to assert against these classnames when testing with Turbopack. Ideally these tests could be more behavioral (e.g. asserting on rendered dimensions), but these can't capture things like fallback fonts. [0] vercel/turbo#3437
Turbopack uses a different format for its css module classnames [0]. This adds and uses a helper function to the next-font tests to assert against these classnames when testing with Turbopack. Ideally these tests could be more behavioral (e.g. asserting on rendered dimensions), but these can't capture things like fallback fonts. [0] vercel/turbo#3437
…vercel/turbo#3437) Fixes WEB-447. Previously, generated classnames would include literal `/` characters, which need escaping when generating selectors. While users should still escape selectors, this avoids it for this case and makes generated code easier to read. This format is also more aligned with what webpack-based css modules generates. This also removes the square character as a separator, since it breaks words and makes double-clicking for selection more difficult.
…vercel/turbo#3437) Fixes WEB-447. Previously, generated classnames would include literal `/` characters, which need escaping when generating selectors. While users should still escape selectors, this avoids it for this case and makes generated code easier to read. This format is also more aligned with what webpack-based css modules generates. This also removes the square character as a separator, since it breaks words and makes double-clicking for selection more difficult.
Fixes WEB-447.
Previously, generated classnames would include literal
/
characters, which need escaping when generating selectors. While users should still escape selectors, this avoids it for this case and makes generated code easier to read. This format is also more aligned with what webpack-based css modules generates.This also removes the square character as a separator, since it breaks words and makes double-clicking for selection more difficult.