Non puoi selezionare più di 25 argomenti Gli argomenti devono iniziare con una lettera o un numero, possono includere trattini ('-') e possono essere lunghi fino a 35 caratteri.

3 anni fa
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. # JSS plugin that adds units to numeric values
  2. [![Gitter](https://badges.gitter.im/JoinChat.svg)](https://gitter.im/cssinjs/lobby)
  3. 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).
  4. Make sure you read [how to use
  5. plugins](https://github.com/cssinjs/jss/blob/master/docs/setup.md#setup-with-plugins)
  6. in general.
  7. ## Setup
  8. ```javascript
  9. import jss from 'jss'
  10. import defaultUnit from 'jss-default-unit'
  11. // Optionally you can customize default units.
  12. const options = {
  13. 'line-height': 'rem',
  14. 'font-size': 'rem'
  15. }
  16. jss.use(defaultUnit(options))
  17. ```
  18. ## Example
  19. ```javascript
  20. const styles = {
  21. container: {
  22. 'line-height': 3,
  23. 'font-size': 1.7,
  24. 'height': 200,
  25. 'z-index': 1
  26. }
  27. }
  28. ```
  29. Compiles to:
  30. ```css
  31. .container-sdf345 {
  32. line-height: 3rem;
  33. font-size: 1.7rem;
  34. height: 200px;
  35. z-index: 1;
  36. }
  37. ```
  38. ## Demo
  39. [Simple](http://cssinjs.github.io/examples/plugins/jss-default-unit/simple/index.html)
  40. ## Issues
  41. File a bug against [cssinjs/jss prefixed with \[jss-default-unit\]](https://github.com/cssinjs/jss/issues/new?title=[jss-default-unit]%20).
  42. ## Run tests
  43. ```bash
  44. npm i
  45. npm run test
  46. ```
  47. ## License
  48. MIT