|
|
3 years ago | |
|---|---|---|
| .. | ||
| dist | 3 years ago | |
| lib | 3 years ago | |
| .DS_Store | 3 years ago | |
| .babelrc | 3 years ago | |
| .eslintrc | 3 years ago | |
| LICENSE | 3 years ago | |
| changelog.md | 3 years ago | |
| karma.conf.js | 3 years ago | |
| package.json | 3 years ago | |
| readme.md | 3 years ago | |
| tests.html | 3 years ago | |
| tests.webpack.js | 3 years ago | |
| webpack.config.js | 3 years ago | |
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.
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))
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;
}
File a bug against cssinjs/jss prefixed with [jss-default-unit].
npm i
npm run test
MIT