unocss-transformer-attribute-values-group
TypeScript icon, indicating that this package has built-in type declarations

0.3.0 • Public • Published

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 setup lang="ts">
const type = ref<'number' | 'text'>()
const name = ref<'jack' | 'tom'>()

function changeTypeAndName() {
  // ......
}
</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 details.

References

Dependents (0)

Package Sidebar

Install

npm i unocss-transformer-attribute-values-group

Weekly Downloads

6

Version

0.3.0

License

MIT

Unpacked Size

8.81 kB

Total Files

7

Last publish

Collaborators

  • lvjiaxuan