Skip to content

Instantly share code, notes, and snippets.

@tomhodgins
Last active July 24, 2020 18:01
Show Gist options
  • Save tomhodgins/2cbf34bb206df1a55c38a4eea4950beb to your computer and use it in GitHub Desktop.
Save tomhodgins/2cbf34bb206df1a55c38a4eea4950beb to your computer and use it in GitHub Desktop.
What if you could pass JSON to CSS as the value of a custom property and access .propertyNames and [indexes]
:root {
--palette: {
"blue": "#06f",
"font": ["Comic Sans MS", "Papyrus"]
};
font-family: --json(var(--palette).font[1]);
color: --color(--json(var(--palette).blue));
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment