Security News
JSR Working Group Kicks Off with Ambitious Roadmap and Plans for Open Governance
At its inaugural meeting, the JSR Working Group outlined plans for an open governance model and a roadmap to enhance JavaScript package management.
@unocss/rule-utils
Advanced tools
@unocss/rule-utils is a utility package designed to assist with the creation and management of rules in UnoCSS, a highly customizable and performant utility-first CSS framework.
Rule Creation
This feature allows you to create custom CSS rules easily. In the example, a rule for setting the background color to red is created.
const { createRule } = require('@unocss/rule-utils');
const rule = createRule('bg-red', { 'background-color': 'red' });
console.log(rule);
Rule Matching
This feature helps in matching a given rule with a specific pattern. The example checks if the rule matches the 'bg-red' pattern.
const { matchRule } = require('@unocss/rule-utils');
const rule = { 'background-color': 'red' };
const isMatch = matchRule('bg-red', rule);
console.log(isMatch);
Rule Parsing
This feature parses a rule string into a more usable format. The example parses the 'bg-red' rule string.
const { parseRule } = require('@unocss/rule-utils');
const ruleString = 'bg-red';
const parsedRule = parseRule(ruleString);
console.log(parsedRule);
PostCSS is a tool for transforming CSS with JavaScript plugins. It offers a wide range of functionalities for CSS processing, including rule creation and manipulation, similar to @unocss/rule-utils, but with a broader scope.
Stylelint is a modern linter that helps you avoid errors and enforce conventions in your styles. It provides functionalities for rule matching and validation, similar to @unocss/rule-utils, but focuses more on linting and enforcing style rules.
CSSTree is a tool for working with CSS, including parsing, generating, and analyzing CSS. It offers functionalities for rule parsing and manipulation, similar to @unocss/rule-utils, but with a focus on detailed CSS analysis and transformation.
The utilities for creating rules/presets for UnoCSS.
MIT License © 2021-PRESENT Anthony Fu
FAQs
Utilities for UnoCSS
The npm package @unocss/rule-utils receives a total of 184,072 weekly downloads. As such, @unocss/rule-utils popularity was classified as popular.
We found that @unocss/rule-utils 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
At its inaugural meeting, the JSR Working Group outlined plans for an open governance model and a roadmap to enhance JavaScript package management.
Security News
Research
An advanced npm supply chain attack is leveraging Ethereum smart contracts for decentralized, persistent malware control, evading traditional defenses.
Security News
Research
Attackers are impersonating Sindre Sorhus on npm with a fake 'chalk-node' package containing a malicious backdoor to compromise developers' projects.