@csstools/custom-function-parser
Parse CSS custom function definitions and calls.
Last updated 10 days ago by romainmenke .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ npm install @csstools/custom-function-parser 
SYNC missed versions from official npm registry.

Custom Function Parser for CSS

npm version Build Status Discord

Implemented from : https://drafts.csswg.org/css-mixins-1/

Usage

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.

Current Tags

  • 2.0.0                                ...           latest (10 days ago)

2 Versions

  • 2.0.0                                ...           10 days ago
  • 1.0.0                                ...           2 months ago
Downloads
Total 4
Today 0
This Week 0
This Month 2
Last Day 0
Last Week 0
Last Month 2
Dependencies (0)
None
Dev Dependencies (0)
None

© 2010 - cnpmjs.org x YWFE | Home | YWFE