Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.
 
 
 
 
rpm-mcarman b9f7ec4306 First Commit 3 лет назад
..
dist First Commit 3 лет назад
lib First Commit 3 лет назад
.DS_Store First Commit 3 лет назад
.babelrc First Commit 3 лет назад
.eslintrc First Commit 3 лет назад
LICENSE First Commit 3 лет назад
changelog.md First Commit 3 лет назад
karma.conf.js First Commit 3 лет назад
package.json First Commit 3 лет назад
readme.md First Commit 3 лет назад
tests.html First Commit 3 лет назад
tests.webpack.js First Commit 3 лет назад
webpack.config.js First Commit 3 лет назад

readme.md

JSS plugin that adds units to numeric values

Gitter

Provide plain numeric values in your JSS style definitions, and the plugin will insert the apposite units. Defaults to px for sizes, ms for durations, and % for transform origins, and these can be customized easily (see Usage Example).

Make sure you read how to use plugins in general.

Setup

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

// Optionally you can customize default units.
const options = {
  'line-height': 'rem',
  'font-size': 'rem'
}

jss.use(defaultUnit(options))

Example

const styles = {
  container: {
    'line-height': 3,
    'font-size': 1.7,
    'height': 200,
    'z-index': 1
  }
}

Compiles to:

.container-sdf345 {
  line-height: 3rem;
  font-size: 1.7rem;
  height: 200px;
  z-index: 1;
}

Demo

Simple

Issues

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

Run tests

npm i
npm run test

License

MIT