$ npm install @csstools/custom-function-parser
Implemented from : https://drafts.csswg.org/css-mixins-1/
Add Custom Function Parser to your project:
npm install @csstools/custom-function-parser @csstools/css-parser-algorithms @csstools/css-tokenizer --save-dev
Custom Function Parser depends on our CSS tokenizer and parser algorithms.
It must be used together with @csstools/css-tokenizer and @csstools/css-parser-algorithms.
import { parse } from '@csstools/custom-function-parser';
const customFunction = parse('--foo(--bar <length>: 1px) returns <length>');
parse() parses a @function prelude.parseFunctionParameters() parses a @mixin or @function parameter list.parseDashedFunctionArguments() parses the arguments of a <dashed-function> call from its component values.All parsing functions return false when the input is invalid.
onParseError only reports tokenizer and component value parsing errors.
The parameters and return type are not validated as <syntax> yet.
Their types are preserved as syntax strings and can be validated by the consumer.
© 2010 - cnpmjs.org x YWFE | Home | YWFE