cssobj-plugin-default-unit
Add default unit to css numeric-like values, which have to specify an unit.
Install
npm install cssobj/cssobj-plugin-default-unit
Usage
var cssobj_core =var defaultUnit =var cssobj =var obj = p: fontSize: 12var result =// the css: p {font-size: 12px;}
API
var plugin = defaultUnit(unit)
Get plugin function to apply, pass unit.
PARAMS
unit
- Type: string
- Default: 'px'
The unit as default unit to add to numeric-like values, accordingly to Unitless List
RETURN
A function can be as cssobj plugin.
Example
// default unit is 'px'// default unit is 'em'
Caveat
line-height
will NOT add unit, since below:
p lineHeight: 15p lineHeight: '22px'
It's both valid with or w/o unit, so this plugin don't touch it.