Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.

3 лет назад
1234567891011121314151617181920212223242526272829303132333435363738
  1. # fbjs-css-vars
  2. This package exports a few of the CSS variables that we use in Facebook projects. This is not the full list we have internally but focused on making available the minimum set needed by our open source projects.
  3. ## Usage
  4. There are almost no use cases where a product will use this module. It will primarily be consumed by one of the following:
  5. ### `cssVar`
  6. This is a module that will read from the list we have here and return the corresponding value. Internally we transform this statically but we don't currently do that in our open source projects.
  7. ```js
  8. React.render(
  9. <div style={{backgroundColor: cssVar('fbui-white')}} />,
  10. containerNode
  11. );
  12. ```
  13. ### CSS
  14. In order to directly sync out our internal CSS and have it parsed by browser, we need to apply some transforms like we do internally. One of those transforms will insert the variables we have available here. In the future we may make use of [CSS Variables](https://developer.mozilla.org/en-US/docs/Web/CSS/Using_CSS_variables).
  15. ```css
  16. .class {
  17. background-color: var(fbui-white);
  18. }
  19. ```
  20. ### Direct Usage
  21. We're just exporting a JS Object so usage is straightforward.
  22. ```js
  23. var fbCSSVars = require('fbjs-css-vars')
  24. console.log(fbCSSVars['fbui-white']);
  25. ```