Package
Validator
Validator for Master CSS syntactic class.
Installation
npm i @master/css-validator
Guarantees 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')// => false
generateValidRules()
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]