\begin{quote}
Discard comments in your CSS files with Post\+CSS. \end{quote}
\hypertarget{md_sfcode_node_modules_postcss_discard_comments_README_autotoc_md20990}{}\doxysection{Install}\label{md_sfcode_node_modules_postcss_discard_comments_README_autotoc_md20990}
With \href{https://npmjs.org/package/postcss-discard-comments}{\texttt{ npm}} do\+:


\begin{DoxyCode}{0}
\DoxyCodeLine{npm install postcss-\/discard-\/comments -\/-\/save }

\end{DoxyCode}
\hypertarget{md_sfcode_node_modules_postcss_discard_comments_README_autotoc_md20991}{}\doxysection{Example}\label{md_sfcode_node_modules_postcss_discard_comments_README_autotoc_md20991}
\hypertarget{md_sfcode_node_modules_postcss_discard_comments_README_autotoc_md20992}{}\doxysubsection{Input}\label{md_sfcode_node_modules_postcss_discard_comments_README_autotoc_md20992}

\begin{DoxyCode}{0}
\DoxyCodeLine{h1/* heading */\{}
\DoxyCodeLine{    margin: 0 auto}
\DoxyCodeLine{\} }

\end{DoxyCode}
\hypertarget{md_sfcode_node_modules_postcss_discard_comments_README_autotoc_md20993}{}\doxysubsection{Output}\label{md_sfcode_node_modules_postcss_discard_comments_README_autotoc_md20993}

\begin{DoxyCode}{0}
\DoxyCodeLine{h1 \{}
\DoxyCodeLine{    margin: 0 auto}
\DoxyCodeLine{\} }

\end{DoxyCode}


This module discards comments from your CSS files; by default, it will remove all regular comments ({\ttfamily /$\ast$ comment $\ast$/}) and preserve comments marked as important ({\ttfamily /$\ast$! important $\ast$/}).

Note that this module does not handle source map comments because they are not available to it; Post\+CSS handles this internally, so if they are removed then you will have to \href{https://github.com/postcss/postcss/blob/master/docs/source-maps.md}{\texttt{ configure source maps in Post\+CSS}}.\hypertarget{md_sfcode_node_modules_postcss_discard_comments_README_autotoc_md20994}{}\doxysection{API}\label{md_sfcode_node_modules_postcss_discard_comments_README_autotoc_md20994}
\hypertarget{md_sfcode_node_modules_postcss_discard_comments_README_autotoc_md20995}{}\doxysubsection{comments(\mbox{[}options\mbox{]})}\label{md_sfcode_node_modules_postcss_discard_comments_README_autotoc_md20995}
\hypertarget{md_sfcode_node_modules_postcss_discard_comments_README_autotoc_md20996}{}\doxysubsubsection{options}\label{md_sfcode_node_modules_postcss_discard_comments_README_autotoc_md20996}
\hypertarget{md_sfcode_node_modules_postcss_discard_comments_README_autotoc_md20997}{}\doxyparagraph{remove(function)}\label{md_sfcode_node_modules_postcss_discard_comments_README_autotoc_md20997}
Type\+: {\ttfamily function} Return\+: {\ttfamily boolean} Variable\+: {\ttfamily comment} contains a comment without {\ttfamily /$\ast$$\ast$/}

For each comment, return true to remove, or false to keep the comment.


\begin{DoxyCode}{0}
\DoxyCodeLine{function(comment) \{\} }

\end{DoxyCode}



\begin{DoxyCode}{0}
\DoxyCodeLine{var css = '/* headings *//*@ h1 */h1\{margin:0 auto\}/*@ h2 */h2\{color:red\}';}
\DoxyCodeLine{console.log(postcss(comments(\{}
\DoxyCodeLine{    remove: function(comment) \{ return comment[0] == "{}@"{}; \}}
\DoxyCodeLine{\})).process(css).css);}
\DoxyCodeLine{//=> /* headings */h1\{margin:0 auto\}h2\{color:red\} }

\end{DoxyCode}
 {\bfseries{NOTE\+:}} If you use the {\ttfamily remove} function other options will not be available.\hypertarget{md_sfcode_node_modules_postcss_discard_comments_README_autotoc_md20998}{}\doxyparagraph{remove\+All}\label{md_sfcode_node_modules_postcss_discard_comments_README_autotoc_md20998}
Type\+: {\ttfamily boolean} Default\+: {\ttfamily false}

Remove all comments marked as important.


\begin{DoxyCode}{0}
\DoxyCodeLine{var css = '/*! heading */h1\{margin:0 auto\}/*! heading 2 */h2\{color:red\}';}
\DoxyCodeLine{console.log(postcss(comments(\{removeAll: true\})).process(css).css);}
\DoxyCodeLine{//=> h1\{margin:0 auto\}h2\{color:red\} }

\end{DoxyCode}
\hypertarget{md_sfcode_node_modules_postcss_discard_comments_README_autotoc_md20999}{}\doxyparagraph{remove\+All\+But\+First}\label{md_sfcode_node_modules_postcss_discard_comments_README_autotoc_md20999}
Type\+: {\ttfamily boolean} Default\+: {\ttfamily false}

Remove all comments marked as important, but the first one.


\begin{DoxyCode}{0}
\DoxyCodeLine{var css = '/*! heading */h1\{margin:0 auto\}/*! heading 2 */h2\{color:red\}';}
\DoxyCodeLine{console.log(postcss(comments(\{removeAllButFirst: true\})).process(css).css);}
\DoxyCodeLine{//=> /*! heading */h1\{margin:0 auto\}h2\{color:red\} }

\end{DoxyCode}
\hypertarget{md_sfcode_node_modules_postcss_discard_comments_README_autotoc_md21000}{}\doxysection{Usage}\label{md_sfcode_node_modules_postcss_discard_comments_README_autotoc_md21000}
See the \href{https://github.com/postcss/postcss\#usage}{\texttt{ Post\+CSS documentation}} for examples for your environment.\hypertarget{md_sfcode_node_modules_postcss_discard_comments_README_autotoc_md21001}{}\doxysection{Contributors}\label{md_sfcode_node_modules_postcss_discard_comments_README_autotoc_md21001}
See \href{https://github.com/cssnano/cssnano/blob/master/CONTRIBUTORS.md}{\texttt{ CONTRIBUTORS.\+md}}.\hypertarget{md_sfcode_node_modules_postcss_discard_comments_README_autotoc_md21002}{}\doxysection{License}\label{md_sfcode_node_modules_postcss_discard_comments_README_autotoc_md21002}
MIT © \href{http://beneb.info}{\texttt{ Ben Briggs}} 