cssvjs

0.0.3 • Public • Published

Logo

Fast, Refined CSS Value-Parser



gzip size brotli size Build Status Download count JSDelivr download count No dependencies Current version Support me

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';
// const {parse} = require('cssvjs'); // Without es6 import
// const {parse} = CSSvJS; // In a browser env
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.

Readme

Keywords

Package Sidebar

Install

npm i cssvjs

Weekly Downloads

1

Version

0.0.3

License

MIT

Unpacked Size

226 kB

Total Files

119

Last publish

Collaborators

  • simonwep