How to use UnoCSS preflights using rules rather than raw CSS?

425 Views Asked by At

Using Uno on a project, cool little library inspired by tailwind.css. I'm trying to do something like a @layer base on tailwind, that is, adding global CSS using rules. In Uno apparently the way to go is with preflights, described in this link: and uses this code:

preflights: [
  {
    getCSS: ({ theme }) => `
      * {
        color: ${theme.colors.gray?.[700] ?? '#333'};
        padding: 0;
        margin: 0;
      }
    `
  }
]

I want to load these preflights but using rules rather than raw CSS, something like this:

preflights: [
  {
    getCSS: ({ theme }) => `
      button {
      'margin-3 border-5 rounded-2px'
      }
    `
  }
]

Any ideas?

0

There are 0 best solutions below