UNPKG

1.1 kBMarkdownView Raw
1[![Build Status](https://img.shields.io/travis/css-modules/icss-replace-symbols/master.svg?style=flat-square)]()
2
3# ICSS — Replace Symbols
4
5Governs the way tokens are searched & replaced during the linking stage of ICSS loading.
6
7This 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))
8
9## API
10
11```js
12import replaceSymbols from "icss-replace-symbols"
13replaceSymbols(css, translations)
14```
15
16Where:
17
18- `css` is the PostCSS tree you're working with
19- `translations` is an JS object of `symbol: "replacement"` pairs, where all occurrences of `symbol` are replaced with `replacement`.
20
21## Behaviour
22
23A symbol is a string of alphanumeric, `-` or `_` characters. A replacement can be any string. They are replaced in the following places:
24
25- In the value of a declaration, i.e. `color: my_symbol;` or `box-shadow: 0 0 blur spread shadow-color`
26- In a media expression i.e. `@media small {}` or `@media screen and not-large {}`
27
28## License
29
30ISC
31
32---
33Glen Maddern, 2015.