An open API service indexing awesome lists of open source software.

https://github.com/simonfinney/parse-css-custom-property

Parse CSS custom property string
https://github.com/simonfinney/parse-css-custom-property

css-custom-properties javascript npm-package

Last synced: 6 months ago
JSON representation

Parse CSS custom property string

Awesome Lists containing this project

README

          

parse-css-custom-property

[![Licensed under the ISC License](https://img.shields.io/badge/license-ISC-blue.svg)](LICENSE)
[![Travis CI](https://travis-ci.org/SimonFinney/parse-css-custom-property.svg?branch=master)](https://travis-ci.org/SimonFinney/parse-css-custom-property)

Parse CSS custom property strings.

## Installation

```bash
npm i -S parse-css-custom-property
```

## Usage

```js
import ParseCSSCustomProperty, {
getDeclaration,
getFallback,
} from 'parse-css-custom-property';

const cssCustomProperty = 'var(--foo, bar)';

// { declaration: '--foo', fallback: 'bar' }
ParseCSSCustomProperty(cssCustomProperty);

// '--foo'
getDeclaration(cssCustomProperty);

// 'bar'
getFallback(cssCustomProperty);
```