Security News
JSR Working Group Kicks Off with Ambitious Roadmap and Plans for Open Governance
At its inaugural meeting, the JSR Working Group outlined plans for an open governance model and a roadmap to enhance JavaScript package management.
@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 158,113 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 2 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
At its inaugural meeting, the JSR Working Group outlined plans for an open governance model and a roadmap to enhance JavaScript package management.
Security News
Research
An advanced npm supply chain attack is leveraging Ethereum smart contracts for decentralized, persistent malware control, evading traditional defenses.
Security News
Research
Attackers are impersonating Sindre Sorhus on npm with a fake 'chalk-node' package containing a malicious backdoor to compromise developers' projects.