JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 142267
  • Score
    100M100P100Q172927F
  • License MIT

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

Package Exports

  • jss-default-unit

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (jss-default-unit) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

JSS logo

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

This plugin lets you omit the unit from values of style properties. Default unit is "px", but you can pass anything else instead.

Demo - JSS

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

Usage example

import jss from 'jss'
import defaultUnit from 'jss-default-unit'

// px is default, lets make default to em
jss.use(defaultUnit({unit: 'em'}))

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

Issues

File a bug against jsstyles/jss prefixed with [jss-default-unit].

Run tests

npm i
npm run test

License

MIT