All skills
onmax avatar

/unocss

@de09c7b official
by Maxonmax/nuxt-skills715 stars
38

UnoCSS instant atomic CSS engine, superset of Tailwind CSS. Use when configuring UnoCSS, writing utility rules, shortcuts, or working with presets like Wind, Icons, Attributify.

Use this Skill: https://skilld.dev/gh/onmax/nuxt-skills/unocss

This session only. Nothing lands on disk.

referencestransformer-compile-class.md

≈560 tokens on demand. Your agent reads this file only when SKILL.md points to it.

Transformer Compile Class

Compiles multiple utility classes into a single hashed class for smaller HTML.

Installation

import { defineConfig, transformerCompileClass } from 'unocss'

export default defineConfig({
  transformers: [
    transformerCompileClass(),
  ],
})

Usage

Add :uno: prefix to mark classes for compilation:

<!-- Before -->
<div class=":uno: text-center sm:text-left">
  <div class=":uno: text-sm font-bold hover:text-red" />
</div>

<!-- After -->
<div class="uno-qlmcrp">
  <div class="uno-0qw2gr" />
</div>

Generated CSS

.uno-qlmcrp {
  text-align: center;
}
.uno-0qw2gr {
  font-size: 0.875rem;
  line-height: 1.25rem;
  font-weight: 700;
}
.uno-0qw2gr:hover {
  --un-text-opacity: 1;
  color: rgb(248 113 113 / var(--un-text-opacity));
}
@media (min-width: 640px) {
  .uno-qlmcrp {
    text-align: left;
  }
}

Options

transformerCompileClass({
  // Custom trigger string (default: ':uno:')
  trigger: ':uno:',

  // Custom class prefix (default: 'uno-')
  classPrefix: 'uno-',

  // Hash function for class names
  hashFn: (str) => /* custom hash */,

  // Keep original classes alongside compiled
  keepOriginal: false,
})

Use Cases

  • Smaller HTML - Reduce repetitive class strings
  • Obfuscation - Hide utility class names in production
  • Performance - Fewer class attributes to parse

ESLint Integration

Enforce compile class usage across project:

{
  "rules": {
    "@unocss/enforce-class-compile": "warn"
  }
}

This rule:

  • Warns when class attribute doesn't start with :uno:
  • Auto-fixes by adding the prefix

Options:

{
  "rules": {
    "@unocss/enforce-class-compile": ["warn", {
      "prefix": ":uno:",
      "enableFix": true
    }]
  }
}

Combining with Other Transformers

export default defineConfig({
  transformers: [
    transformerVariantGroup(),  // Process variant groups first
    transformerDirectives(),    // Then directives
    transformerCompileClass(),  // Compile last
  ],
})
<!-- Source references: - https://unocss.dev/transformers/compile-class -->

Source: SKILL.md on GitHub

No alerts9d3 checks · Risk SAFE
  • Gen Agent Trust Hub9d

    The skill is a comprehensive documentation set for UnoCSS, providing guidance on configuration, rules, presets, and framework integrations. It is a legitimate resource for web development, although it involves standard development tasks like installing packages and analyzing project files which presents a standard attack surface.

  • Socket9d

    No alerts

  • Snyk9d

    Risk: LOW · No issues

Signed by skilld at de09c7b. This ties the file your Agent reads to that commit on GitHub. It does not review the instructions.

Last checked against GitHub 2 days ago.

Activeupdated last week
Other metadata
metadata
{
  "author": "Anthony Fu",
  "version": "2026.1.28",
  "source": "Generated from https://github.com/unocss/unocss, scripts located at https://github.com/antfu/skills"
}

README badge

README badge for onmax/nuxt-skills/unocss