PoC: Use CSS modules for the Agama components #1874
Draft
+12
−16
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
CSS modules
When working with Docusaurus I learned about the CSS modules.
With the current implementation it is very hard to find the CSS related to the component code. For example the
FirstUserForm
component defines its CSS style inassets/styles/app.scss
file somewhere in the middle. That's quite difficult to find.Pros and cons
CSS modules have several advantages:
agama-
prefix or long names likefirst-username-dropdown
. That's not nice.Of course, there also some disadvantages
Iv3X764_hcFfxZFNQLEm
from which is not obvious what was the original name. Fortunately CSS modules support source mapping properly so you can get the original name and the exact location in the source file quite easily in the browser devtools.Notes
Proof of concept
In this example I moved the the CSS for the
FirstUserForm
component to separateFirstUserForm.module.scss
file. We could do the same for the other components as well.