Security News
ESLint is Now Language-Agnostic: Linting JSON, Markdown, and Beyond
ESLint has added JSON and Markdown linting support with new officially-supported plugins, expanding its versatility beyond JavaScript.
@unocss/transformer-variant-group
Advanced tools
@unocss/transformer-variant-group is a transformer for UnoCSS that allows you to group variant utilities together, making your CSS more concise and easier to read.
Grouping Variants
This feature allows you to group multiple variant utilities together. In this example, the `hover` and `focus` variants are grouped to apply different background and text colors when the element is hovered or focused.
```html
<div class="hover:(bg-blue-500 text-white) focus:(bg-red-500 text-black)">
Hover or focus on me!
</div>
```
Nested Variants
This feature allows you to nest variants within responsive breakpoints. In this example, the `sm:hover` and `md:focus` variants are nested to apply different styles based on screen size and interaction state.
```html
<div class="sm:hover:(bg-green-500 text-white) md:focus:(bg-yellow-500 text-black)">
Responsive hover and focus!
</div>
```
Tailwind CSS is a utility-first CSS framework that provides low-level utility classes to build custom designs. It does not natively support grouping variants in the same way as @unocss/transformer-variant-group, but it offers a wide range of utilities and plugins for extended functionality.
Windi CSS is a next-generation utility-first CSS framework that is highly optimized for speed. It offers similar functionalities to Tailwind CSS and includes features like variant grouping through its own syntax, making it comparable to @unocss/transformer-variant-group.
Enables the variant group feature of Windi CSS for UnoCSS.
npm i -D @unocss/transformer-variant-group
// uno.config.ts
import { defineConfig } from 'unocss'
import transformerVariantGroup from '@unocss/transformer-variant-group'
export default defineConfig({
// ...
transformers: [
transformerVariantGroup(),
],
})
<div class="hover:(bg-gray-400 font-medium) font-(light mono)"/>
Will be transformed to:
<div class="hover:bg-gray-400 hover:font-medium font-light font-mono"/>
MIT License © 2021-PRESENT Anthony Fu
FAQs
Variant group transformer for UnoCSS
The npm package @unocss/transformer-variant-group receives a total of 159,660 weekly downloads. As such, @unocss/transformer-variant-group popularity was classified as popular.
We found that @unocss/transformer-variant-group demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
ESLint has added JSON and Markdown linting support with new officially-supported plugins, expanding its versatility beyond JavaScript.
Security News
Members Hub is conducting large-scale campaigns to artificially boost Discord server metrics, undermining community trust and platform integrity.
Security News
NIST has failed to meet its self-imposed deadline of clearing the NVD's backlog by the end of the fiscal year. Meanwhile, CVE's awaiting analysis have increased by 33% since June.