Fast, Refined CSS Value-Parser
Getting Started
⚠ cssvjs is currently not stable and heavily under development.
The API might change and all 0.0.x
releases should be treated as test / preview releases.
Install via npm:
$ npm install cssvjs
Install via yarn:
$ yarn add cssvjs
Include directly via jsdelivr:
<script src="https://cdn.jsdelivr.net/npm/graceful-ws/dist/cssvjs.min.js"></script>
Usage
import {parse} from 'cssvjs';
console.log(parse(`rgba(40 54 22 / 23%)`));
which will print the following to the console:
{
type: 'color',
format: 'rgba',
value: [
{type: 'number', value: 40},
{type: 'number', value: 54},
{type: 'number', value: 22},
{type: 'percentage', value: 23}
]
}
Supported values
All values are fully tested, submit an issue if you find a bug.
I'll slowly fill add more types. Version 1.0.0
will cover all the basic ones.