-
Notifications
You must be signed in to change notification settings - Fork 532
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
Generate "system" CSS #147
Conversation
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.
This is really really cool work! Amazing job! I don't see anything that pops out so far 👍
Curious why we run this every time we start the server vs just running it when we build in Travis? I'm also interested in what the reasoning is for rebuilding the css often vs just generating the css once? Will new css rules need to be added fairly often as our API changes or will that be a fairly infrequent situation?
@@ -22,6 +22,7 @@ module.exports = ({ | |||
<link rel='stylesheet' href='https://unpkg.com/primer-product/build/build.css'/> | |||
<link rel='stylesheet' href='https://unpkg.com/primer-tooltips/build/build.css'/> | |||
<link rel='stylesheet' href='https://unpkg.com/primer-utilities/build/build.css'/> | |||
<link rel='stylesheet' href='${publicPath}system.css' /> |
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.
Did you end up getting this to work?
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.
Nope, not yet. I'm going to try inlining it via our Styles component.
@emplums Having it built all the time |
Closing in favor of merging via #155. |
This PR adds a build step that generates static CSS for each of our "system" props in #145. You can see the CSS that it generates in
docs/system.css
.Selectors
.bg-{color}
for all values incolors.bg.*
.border-{color}
for all values incolors.border.*
.color-{color}-{index}
for allcolors.*.*
(exceptcolors.bg
andcolors.border
).color-{color}
shorthands forcolors.*[5]
.f-{index}
for allfontSizes
values (responsive).border-width-{index}
for all values inborderWidths
(missing).font-weight-{name}
for allfontWeight
values (missing).lh-{name}
for all values inlineHeights
(missing).max-width-*
for allmaxWidths
values?.round-{index}
for allradii
values (responsive?).w-{ratio}
for column grid widths? (missing)For now I'm also including responsive whitespace (margin and padding) utilities as a test. We won't need them in the initial release because primer-utilities already provides them.
I went with PostCSS because the AST API is super simple and easy to use, and this allows us to chain additional plugins for (later) adding custom property support, minifying the resulting CSS, etc.