Socket
Socket
Sign inDemoInstall

@unocss/transformer-directives

Package Overview
Dependencies
Maintainers
1
Versions
250
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@unocss/transformer-directives - npm Package Compare versions

Comparing version 0.32.1 to 0.32.7

12

dist/index.d.ts

@@ -6,6 +6,14 @@ import { SourceCodeTransformer, UnoGenerator } from '@unocss/core';

enforce?: SourceCodeTransformer['enforce'];
/**
* Treat CSS variables as directives for CSS syntax compatible.
*
* Pass `false` to disable, or a string to use as a prefix.
*
* @default '--at-'
*/
varStyle?: false | string;
}
declare function transformerDirectives(options?: TransformerDirectivesOptions): SourceCodeTransformer;
declare function transformDirectives(code: MagicString, uno: UnoGenerator, filename?: string, originalCode?: string, offset?: number): Promise<void>;
declare function transformDirectives(code: MagicString, uno: UnoGenerator, options: TransformerDirectivesOptions, filename?: string, originalCode?: string, offset?: number): Promise<void>;
export { transformerDirectives as default, transformDirectives };
export { TransformerDirectivesOptions, transformerDirectives as default, transformDirectives };

6

package.json
{
"name": "@unocss/transformer-directives",
"version": "0.32.1",
"version": "0.32.7",
"description": "UnoCSS transformer for `@apply` directive",

@@ -34,3 +34,3 @@ "keywords": [

"dependencies": {
"@unocss/core": "0.32.1",
"@unocss/core": "0.32.7",
"css-tree": "^2.1.0"

@@ -45,3 +45,3 @@ },

},
"readme": "# @unocss/transformer-directives\n\nUnoCSS transformer for `@apply` directive\n\n## Install\n\n```bash\nnpm i -D @unocss/transformer-directives\n```\n\n```ts\nimport Unocss from 'unocss/vite'\nimport transformerDirective from '@unocss/transformer-directives'\n\nUnocss({\n transformers: [\n transformerDirective(),\n ],\n})\n```\n\n## Usage\n\n```css\n.custom-div {\n @apply text-center my-0 font-medium;\n}\n```\n\nWill be transformed to:\n\n```css\n.custom-div {\n margin-top: 0rem;\n margin-bottom: 0rem;\n text-align: center;\n font-weight: 500;\n}\n```\n\n> Currently only `@apply` is supported.\n\n## License\n\nMIT License © 2022 [hannoeru](https://github.com/hannoeru)\n"
"readme": "# @unocss/transformer-directives\n\nUnoCSS transformer for `@apply` directive\n\n## Install\n\n```bash\nnpm i -D @unocss/transformer-directives\n```\n\n```ts\nimport Unocss from 'unocss/vite'\nimport transformerDirective from '@unocss/transformer-directives'\n\nUnocss({\n transformers: [\n transformerDirective(),\n ],\n})\n```\n\n## Usage\n\n```css\n.custom-div {\n @apply text-center my-0 font-medium;\n}\n```\n\nWill be transformed to:\n\n```css\n.custom-div {\n margin-top: 0rem;\n margin-bottom: 0rem;\n text-align: center;\n font-weight: 500;\n}\n```\n\n> Currently only `@apply` is supported.\n\n### CSS Variable Style\n\nTo be compatible with vanilla CSS, you can use CSS Variables to replace the `@apply` directive.\n\n```css\n.custom-div {\n --at-apply: text-center my-0 font-medium;\n}\n```\n\nTo use rules with `:`, you will need to quote the value\n\n```css\n.custom-div {\n --at-apply: \"hover:text-red\";\n}\n```\n\nThis feature is enabled by default (with prefix `--at-`), can you configure it or disable it via:\n\n```js\ntransformerDirective({\n varStyle: '--my-at-',\n // or disable with:\n // varStyle: false\n})\n```\n\n## License\n\nMIT License &copy; 2022-PRESENT [hannoeru](https://github.com/hannoeru)\n"
}

@@ -43,4 +43,32 @@ # @unocss/transformer-directives

### CSS Variable Style
To be compatible with vanilla CSS, you can use CSS Variables to replace the `@apply` directive.
```css
.custom-div {
--at-apply: text-center my-0 font-medium;
}
```
To use rules with `:`, you will need to quote the value
```css
.custom-div {
--at-apply: "hover:text-red";
}
```
This feature is enabled by default (with prefix `--at-`), can you configure it or disable it via:
```js
transformerDirective({
varStyle: '--my-at-',
// or disable with:
// varStyle: false
})
```
## License
MIT License © 2022 [hannoeru](https://github.com/hannoeru)
MIT License &copy; 2022-PRESENT [hannoeru](https://github.com/hannoeru)

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc