Features
- Generate smart and efficient code (just like hand written) at compile time. Leaving no runtime overhead.
- Support autocomplete with TailwindCSS IntelliSense.
Installation
Configure autocomplete
- Install TailwindCSS IntelliSense
- Create
tailwind.config.jsin your project (recommend in the root folder) and add the following content
module.exports = ;
- Add the following settings to your
settings.jsonin vscode
How does it work?
bevy_tailwind will generate corresponding components for given tailwind classes. For example
tw!;
will generate the following components Node, BackgroundColor, ZIndex, BorderColor
When using object syntax, it will apply priority when generating code. Consider the following example, all flex, block and grid is applied to the display property, but the latter will have higher priority. So the order is grid, block, flex.
tw!;
And here is the generated code
Now consider more complex example. pl has higher priority than px, p and the latter one will overwrite. So the order for padding left is pl-4, pl-3(from px-3 but this will be overwrite by pl-4), pl-2, pl-5(from p-5), pl-1(from p-1).
tw!;
And here is the generated code (for padding left only, other properties are ommitted to reduce code size for this example). You can see the code is for pl-3 from px-3 is not generated because it will always be overwritten by pl-4
Bevy compatibility
bevy_tailwind |
bevy |
|---|---|
| 0.1.0 | 0.15.0 |