mpal9000 / jss-px

Adds default px unit to numeric values where needed.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

JSS logo

JSS plugin that adds default px unit to numeric values where needed

This plugin lets you omit the px unit from values of style properties.

Demo - JSS

![Gitter](https://badges.gitter.im/Join Chat.svg)

Usage example

import jss from 'jss'
import px from 'jss-px'

jss.use(px)

const styleSheet = jss.createStyleSheet({
  container: {
    'font-size': 20,
    'z-index': 1,
    'line-height': 1.2
  }
})
console.log(styleSheet.toString())
.jss-0-0 {
  font-size: 20px;
  z-index: 1;
  line-height: 1.2;
}
console.log(styleSheet.classes)
{ container: "jss-0-0" }

Run tests

npm i
npm run test

License

MIT

About

Adds default px unit to numeric values where needed.

License:MIT License


Languages

Language:JavaScript 81.2%Language:HTML 18.8%