Security News
Research
Data Theft Repackaged: A Case Study in Malicious Wrapper Packages on npm
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
@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
The npm package @unocss/extractor-arbitrary-variants receives a total of 190,010 weekly downloads. As such, @unocss/extractor-arbitrary-variants popularity was classified as popular.
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
Research
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
Research
Security News
Attackers used a malicious npm package typosquatting a popular ESLint plugin to steal sensitive data, execute commands, and exploit developer systems.
Security News
The Ultralytics' PyPI Package was compromised four times in one weekend through GitHub Actions cache poisoning and failure to rotate previously compromised API tokens.