-
Notifications
You must be signed in to change notification settings - Fork 19
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
RFC: @inherits for easier composition of multiple styles #633
Comments
Is this really any different than:
I guess I'm more curious as to what problem this is trying to solve? Is it having too many |
@stffrd in your example this is the output from the CSS file. const css = require("./inheritor.css");
//css is
/*
{
rulec : "abcd123_rulea dcba_321_rulec"
}
*/ if you wanted to also get /* inheritor.css */
@value parent: "./file-to-inherit-from.css";
.rulea {
composes: rulea from parent;
}
.ruleb {
composes: ruleb from parent;
}
.rulec {
composes: rulea from parent;
background-color: red;
} which is already annoying me with 3 rules, and if I imagine 10+ it seems nightmarish. |
Oh I see. Yeah I can see this being different enough that it'd be useful! |
Feedback from a chat:
I think renaming this is probably a good plan, maybe instead of Other thoughts based on this feedback:
|
Not having to do .rulea {
composes: rulea from parent;
} or import css from "./index.css";
import css2 from "../../someOtherCss.css"; sounds rad! |
Fixes #633 Adds a new `@composes` at-rule that can be used to include all of the exported classes/compositions from one other file.
Released in |
Feature Use Case
modular-css
already supports wildcard values like@value * from "./file.css";
that basically sucks in all values from the specified file and makes them available in the local scope.Something like that for classes/IDs would be pretty convenient as well.
Feature Proposal
@inherits: "./file-to-inherit-from.css";
would export
The text was updated successfully, but these errors were encountered: