Security News
NVD Backlog Tops 20,000 CVEs Awaiting Analysis as NIST Prepares System Updates
NVD’s backlog surpasses 20,000 CVEs as analysis slows and NIST announces new system updates to address ongoing delays.
@unocss/extractor-arbitrary-variants
Advanced tools
@unocss/extractor-arbitrary-variants is a package designed to work with UnoCSS, a utility-first CSS framework. This package allows you to extract and apply arbitrary variants to your CSS classes, enabling more dynamic and flexible styling options.
Arbitrary Variants Extraction
This feature allows you to extract arbitrary variants from a given string. In this example, the 'hover:bg-red-500' variant is extracted and logged.
import { extractorArbitraryVariants } from '@unocss/extractor-arbitrary-variants';
const variants = extractorArbitraryVariants('hover:bg-red-500');
console.log(variants); // Output: ['hover:bg-red-500']
Integration with UnoCSS
This feature demonstrates how to integrate the arbitrary variants extractor with UnoCSS. By adding the extractor to the UnoCSS configuration, you can enable the use of arbitrary variants in your project.
import { defineConfig } from 'unocss';
import { extractorArbitraryVariants } from '@unocss/extractor-arbitrary-variants';
export default defineConfig({
extractors: [
extractorArbitraryVariants(),
],
});
Tailwind CSS is a utility-first CSS framework that provides low-level utility classes to build custom designs. While it does not have a direct equivalent to @unocss/extractor-arbitrary-variants, it offers a similar approach to styling with utility classes and supports custom variants through its configuration.
PostCSS is a tool for transforming CSS with JavaScript plugins. It can be used to create custom plugins that achieve similar functionality to @unocss/extractor-arbitrary-variants, such as extracting and applying custom variants. However, it requires more setup and custom plugin development.
Styled-components is a library for React and React Native that allows you to use component-level styles in your application. While it does not provide the same utility-first approach as @unocss/extractor-arbitrary-variants, it offers a way to create dynamic and reusable styles using JavaScript.
Exactor to support arbitrary variants for utilities.
Please refer to the documentation.
MIT License © 2022-PRESENT Anthony Fu
FAQs
Extractor arbitrary variants for utilities
We found that @unocss/extractor-arbitrary-variants demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 2 open source maintainers collaborating on the project.
Did you know?
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.
Security News
NVD’s backlog surpasses 20,000 CVEs as analysis slows and NIST announces new system updates to address ongoing delays.
Security News
Research
A malicious npm package disguised as a WhatsApp client is exploiting authentication flows with a remote kill switch to exfiltrate data and destroy files.
Security News
PyPI now supports digital attestations, enhancing security and trust by allowing package maintainers to verify the authenticity of Python packages.