@igniteonline/css-vars
v1.0.3
Published
Simple utility to allow for reading and setting CSS variables from within your Javascript
Downloads
6
Readme
CSS Vars
This is a simple utility to allow for reading and setting CSS variables from within your Javascript
Installation
yarn add @igniteonline/css-vars
Usage
Include the package
import cssVar from '@igniteonline/css-vars';
const bannerHeight = cssVar('banner-height')
// Will also work with leading hyphens
const bannerHeight = cssVar('--banner-height')
Units should be considered; Return values may required parsing, eg:
const bannerHeight = parseInt( cssVar('--banner-height') )
Set a CSS variable by adding a value as a second argument, eg:
cssVar('--primary', '#C60')