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

Discussion: Allow to use global css grid names (not hashed like in post-cssmodules) #460

Open
mhsdesign opened this issue Apr 4, 2023 · 2 comments

Comments

@mhsdesign
Copy link

mhsdesign commented Apr 4, 2023

It seems this topic has been briefly discussed in: #144
And i was wondering if there are plans or if it fits your philosophy to have an option to allow css grid names to be used without hashing (scoped to the current module).

If youre wondering what our use case is:
Previously we have used post-cssmodules, where the grid-areas are global, and thus they could be consumed by plugin authors to extend/modify our app in unplanned ways. (I agree its not pretty, but it works - so why not ^^ neos/neos-ui#3450)

To me it seems that there are currently two workarounds to achieve this:

A:
by using css variables

.container {
    --grid-areas: "left top right" "left main right";
    --grid-area-right: right;
    grid-template-areas: var(--grid-areas);
}

.gridRight {
    grid-area: var(--grid-area-right);
}

B:
by using some global css file and compose from global:
global.css

.my-css-grid {
    grid-template-areas: "left top right" "left main right";
}

.my-css-grid-right {
  grid-area: right;
}

my.module.css

.container {
    composes: my-css-grid from global;
}
.gridRight {
    composes: my-css-grid-right from global;
}

What do you say? Does it make sense as native feature?

@devongovett
Copy link
Member

The main blocker is that we need a syntax to reference a global identifier. In selectors, there is :global(.foo), but this doesn't work for other identifiers like grid names, keyframe animation names, etc. The composes property uses foo from global, but this is kinda weird when declaring grid names or keyframes. Maybe we could have a function syntax like global(name) but idk. Ideally such a syntax would also be interoperable between different CSS modules implementations.

@devongovett
Copy link
Member

Made a proposal for this: css-modules/css-modules#390

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

No branches or pull requests

2 participants