Socket
Socket
Sign inDemoInstall

@unocss/transformer-directives

Package Overview
Dependencies
1
Maintainers
1
Versions
235
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

@unocss/transformer-directives


Version published
Maintainers
1
Created

Package description

What is @unocss/transformer-directives?

@unocss/transformer-directives is a transformer for UnoCSS that allows you to use CSS directives within your stylesheets. It provides a way to use utility-first CSS directly in your stylesheets, making it easier to manage and apply styles dynamically.

What are @unocss/transformer-directives's main functionalities?

Using @apply directive

The @apply directive allows you to apply multiple utility classes to a single CSS rule. This makes it easier to manage and reuse styles across your project.

/* styles.css */
.button {
  @apply bg-blue-500 text-white font-bold py-2 px-4 rounded;
}

Using @screen directive

The @screen directive allows you to apply styles based on breakpoints. This is useful for creating responsive designs that adapt to different screen sizes.

/* styles.css */
@screen md {
  .container {
    @apply p-4;
  }
}

Using @variants directive

The @variants directive allows you to apply styles based on different states like hover, focus, etc. This is useful for creating interactive elements that change styles based on user interactions.

/* styles.css */
@variants hover, focus {
  .button {
    @apply bg-blue-700;
  }
}

Other packages similar to @unocss/transformer-directives

Readme

Source

@unocss/transformer-directives

UnoCSS transformer for @apply directive

Install

npm i -D @unocss/transformer-directives
import Unocss from 'unocss/vite'
import transformerDirective from '@unocss/transformer-directives'

Unocss({
  transformers: [
    transformerDirective(),
  ]
})

Usage

Currently only @apply is supported.

License

MIT License © 2022 hannoeru

Keywords

FAQs

Last updated on 21 Feb 2022

Did you know?

Socket

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc