Introducing Pollen
The CSS variables build system
Last updated
.button {
font-family: var(--font-sans);
font-size: var(--scale-00);
font-weight: var(--weight-medium);
line-height: var(--line-none);
padding: var(--size-3) var(--size-5);
background: var(--color-blue);
border-radius: var(--radius-xs);
color: white;
}const Button = styled.button`
font-family: var(--font-sans);
font-size: var(--scale-00);
font-weight: var(--weight-medium);
line-height: var(--line-none);
padding: var(--size-3) var(--size-5);
background: var(--color-blue);
border-radius: var(--radius-xs);
color: white;
`<button styles={{
fontFamily: 'var(--font-sans)',
fontSize: 'var(--scale-00)',
fontWeight: 'var(--weight-medium)',
lineHeight: 'var(--line-none)',
padding: 'var(--size-3) var(--size-5)',
background: 'var(--color-blue)',
borderRadius: 'var(--radius-xs)'
color: 'white'
}}>
Button
</button>
<button style="font-family: var(--font-sans); font-size: var(--scale-00); font-weight: var(--weight-medium); line-height: var(--line-none); padding: var(--size-3) var(--size-5); background: var(--color-blue); border-radius: var(--radius-xs); color: white;">
Button
</button>module.exports = (pollen) => ({
output: './pollen.css',
modules: {
color: {
...pollen.colors,
bg: 'white',
text: 'var(--color-black)'
}
},
media: {
'(prefers-color-scheme: dark)': {
color: {
bg: 'var(--color-black)',
text: 'white'
}
}
}
});$ pollen:root {
...
--color-bg: white;
--color-text: var(--color-black);
}
@media (prefers-color-scheme: dark) {
:root {
--color-bg: var(--color-black);
--color-text: white;
}
}