Closed silveltman closed 11 months ago
With another setup I get different, but still unexpected behaviour. Config:
// uno.config.ts
import { defineConfig, presetUno } from 'unocss';
import presetTheme from 'unocss-preset-theme';
export default defineConfig({
theme: {
colors: {
fontSize: {
myfont: '40px'
}
}
},
presets: [
presetUno(),
//@ts-ignore
presetTheme({
theme: {
// Configure dark themes
large: {
fontSize: {
myfont: '60px'
}
},
// Configure compact themes
small: {
fontSize: {
myfont: '20px'
}
}
}
})
]
});
html:
<h1 class="text-myfont">hello world</h1>
<h1 class="text-myfont small">hello world</h1>
The default theme is not applied when no theme class is set. This would mean I would have to create a medium class too, and aply that to the body or something. Would not be a problem to me, but the docs say this is not neccesary.
Your configuration of the default theme isn't right. The fontSize
should define in theme
, the same level as colors
.
I see, stupid mistake.. Thanks!
I have the following config:
it putputs this css:
Am I missing something?
Playground: https://uno.antfu.me/play/?html=DwEwlgbgBAxgNgQwM5ILwCJ0D4BQwAWAjLIihgC4CmAHuQLQC2AnjAPZysBO2%2BlcHUAO5c4IYAHoiuCeAi48sksjTpm5Xg0rY8RJWXRVajFuy48%2BA4Z1ESpecbKA&config=PTAEFcDsHsDoGNqQGYEsDmsAuBnAUKgLYAO0ATlqAN6gAmApmpPQMJJroA0oxZ9O9LAFUYoAL6hkZaIVAByKNHg4ccgiXKVe-QQBUAFvUL1J02QpjKcAWm0Cs1rIeNq89AB6kKdRgENwADaUDEys7BgAFFR4oKBORvQAXNQxsaCIAeQ4ydFpaYQAnhnkyXJ8tGp5YqlinKl2gtmgANqpsQ3CMBEAlHV5HQYJUW1p8cY5I3mFY0kpefPp0JlkTbkL84XFZKUARgHg9JXrsdXHtZPiI2LdqQC6dddAA&css=Q&options=N4XyA