\href{https://travis-ci.org/css-modules/icss-utils}{\texttt{ }}\hypertarget{md_sfcode_node_modules_icss_utils_README_autotoc_md12590}{}\doxysection{ICSS Utils}\label{md_sfcode_node_modules_icss_utils_README_autotoc_md12590}
\hypertarget{md_sfcode_node_modules_icss_utils_README_autotoc_md12591}{}\doxysubsection{replace\+Symbols}\label{md_sfcode_node_modules_icss_utils_README_autotoc_md12591}
Governs the way tokens are searched \& replaced during the linking stage of ICSS loading.

This is broken into its own module in case the behaviour needs to be replicated in other Post\+CSS plugins (i.\+e. \href{https://github.com/css-modules/postcss-modules-values}{\texttt{ CSS Modules Values}})


\begin{DoxyCode}{0}
\DoxyCodeLine{import \{ replaceSymbols, replaceValueSymbols \} from "{}icss-\/utils"{};}
\DoxyCodeLine{}
\DoxyCodeLine{replaceSymbols(css, replacements);}
\DoxyCodeLine{replaceValueSymbols(string, replacements); }

\end{DoxyCode}


Where\+:


\begin{DoxyItemize}
\item {\ttfamily css} is the Post\+CSS tree you\textquotesingle{}re working with
\item {\ttfamily replacements} is an JS object of {\ttfamily symbol\+: \char`\"{}replacement\char`\"{}} pairs, where all occurrences of {\ttfamily symbol} are replaced with {\ttfamily replacement}.
\end{DoxyItemize}

A symbol is a string of alphanumeric, {\ttfamily -\/} or {\ttfamily \+\_\+} characters. A replacement can be any string. They are replaced in the following places\+:


\begin{DoxyItemize}
\item In the value of a declaration, i.\+e. {\ttfamily color\+: my\+\_\+symbol;} or {\ttfamily box-\/shadow\+: 0 0 blur spread shadow-\/color}
\item In a media expression i.\+e. {\ttfamily @media small \{\}} or {\ttfamily @media screen and not-\/large \{\}}
\end{DoxyItemize}\hypertarget{md_sfcode_node_modules_icss_utils_README_autotoc_md12592}{}\doxysubsection{extract\+ICSS(css, remove\+Rules = true)}\label{md_sfcode_node_modules_icss_utils_README_autotoc_md12592}
Extracts and remove (if remove\+Rules is equal true) from Post\+CSS tree {\ttfamily \+:import} and {\ttfamily \+:export} statements.


\begin{DoxyCode}{0}
\DoxyCodeLine{import postcss from "{}postcss"{};}
\DoxyCodeLine{import \{ extractICSS \} from "{}icss-\/utils"{};}
\DoxyCodeLine{}
\DoxyCodeLine{const css = postcss.parse(`}
\DoxyCodeLine{  :import(colors) \{}
\DoxyCodeLine{    a: b;}
\DoxyCodeLine{  \}}
\DoxyCodeLine{  :export \{}
\DoxyCodeLine{    c: d;}
\DoxyCodeLine{  \}}
\DoxyCodeLine{`);}
\DoxyCodeLine{}
\DoxyCodeLine{extractICSS(css);}
\DoxyCodeLine{/*}
\DoxyCodeLine{  \{}
\DoxyCodeLine{    icssImports: \{}
\DoxyCodeLine{      colors: \{}
\DoxyCodeLine{        a: 'b'}
\DoxyCodeLine{      \}}
\DoxyCodeLine{    \},}
\DoxyCodeLine{    icssExports: \{}
\DoxyCodeLine{      c: 'd'}
\DoxyCodeLine{    \}}
\DoxyCodeLine{  \}}
\DoxyCodeLine{*/ }

\end{DoxyCode}
\hypertarget{md_sfcode_node_modules_icss_utils_README_autotoc_md12593}{}\doxysubsection{create\+ICSSRules(icss\+Imports, icss\+Exports)}\label{md_sfcode_node_modules_icss_utils_README_autotoc_md12593}
Converts icss imports and exports definitions to postcss ast


\begin{DoxyCode}{0}
\DoxyCodeLine{createICSSRules(}
\DoxyCodeLine{  \{}
\DoxyCodeLine{    colors: \{}
\DoxyCodeLine{      a: "{}b"{}}
\DoxyCodeLine{    \}}
\DoxyCodeLine{  \},}
\DoxyCodeLine{  \{}
\DoxyCodeLine{    c: "{}d"{}}
\DoxyCodeLine{  \}}
\DoxyCodeLine{); }

\end{DoxyCode}
\hypertarget{md_sfcode_node_modules_icss_utils_README_autotoc_md12594}{}\doxysubsection{License}\label{md_sfcode_node_modules_icss_utils_README_autotoc_md12594}
ISC

\DoxyHorRuler{0}


Glen Maddern, Bogdan Chadkin and Evilebottnawi 2015-\/present. 