You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

33 lines
1.1 KiB

4 years ago
  1. [![Build Status](https://img.shields.io/travis/css-modules/icss-replace-symbols/master.svg?style=flat-square)]()
  2. # ICSS — Replace Symbols
  3. Governs the way tokens are searched & replaced during the linking stage of ICSS loading.
  4. This is broken into its own module in case the behaviour needs to be replicated in other PostCSS plugins (i.e. [CSS Modules Constants](https://github.com/css-modules/postcss-modules-constants))
  5. ## API
  6. ```js
  7. import replaceSymbols from "icss-replace-symbols"
  8. replaceSymbols(css, translations)
  9. ```
  10. Where:
  11. - `css` is the PostCSS tree you're working with
  12. - `translations` is an JS object of `symbol: "replacement"` pairs, where all occurrences of `symbol` are replaced with `replacement`.
  13. ## Behaviour
  14. A symbol is a string of alphanumeric, `-` or `_` characters. A replacement can be any string. They are replaced in the following places:
  15. - In the value of a declaration, i.e. `color: my_symbol;` or `box-shadow: 0 0 blur spread shadow-color`
  16. - In a media expression i.e. `@media small {}` or `@media screen and not-large {}`
  17. ## License
  18. ISC
  19. ---
  20. Glen Maddern, 2015.