套件
@master/css-validator@master/css-validator
Validate Master CSS syntax
Installation
npm i @master/css-validatorGuarantees validity by validating CSS rules generated by the Master CSS syntactic class, including checking media queries, selectors, and declarations.
This package is specific to the Node.js environment.
API Reference
isClassValid()
Validates that the string is valid Master CSS syntactic class.
| Argument | Type | Default |
|---|---|---|
syntax | string | undefined |
css? | MasterCSS | - |
return | boolean | - |
import { isClassValid } from '@master/css-validator'isClassValid('text:center')// => trueisClassValid('love:css')// => falsegenerateValidRules()
Validate syntax validity and create Master CSS rules.
| Argument | Type | Default |
|---|---|---|
syntax | string | undefined |
css? | MasterCSS | - |
return | Rule[] | - |
import { generateValidRules } from '@master/css-validator'generateValidRules('text:center')// => [{...}]generateValidRules('love:css')// => []validate()
Validate and report errors for the given syntax.
| Argument | Type | Default |
|---|---|---|
syntax | string | undefined |
css? | MasterCSS | - |
return | SyntaxError[] | - |
import { validate } from '@master/css-validator'validate('text:center')// => []validate('love:css')// => [SyntaxError]