lvjiaxuan / unocss-transformer-attribute-values-group

Attribute values group transformer for UnoCSS.

Home Page:https://unocss.dev/presets/community#community-transformers

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

npm

Installation

pnpm add -D unocss-transformer-attribute-values-group

Usage

// uno.config.ts
import { defineConfig } from 'unocss'
import transformerAttrValuesGroup from 'unocss-transformer-attribute-values-group'

export default defineConfig({
  // ...
  transformers: [
    transformerAttrValuesGroup,
  ],
})
<script>
// ...
</script>

<template>
  <input
    :type="type"
    class="[&[type=(number text)]]:c-red"
  >
  <div
    :data-name="name"
    class="data-[name=(jack tom)]:c-red"
  />
</template>

transformed like:

<input class="[&[type=number],&[type=text]]:c-red" />
<div class="data-[name=jack]:c-red data-[name=tom]:c-red" />

tests for more usages.

References

About

Attribute values group transformer for UnoCSS.

https://unocss.dev/presets/community#community-transformers

License:MIT License


Languages

Language:HTML 89.6%Language:TypeScript 10.3%Language:JavaScript 0.1%