minify-css-string
v1.0.0
Published
Remove new lines and extra space from a string of css.
Downloads
33,190
Readme
minify-css-string
Remove new lines and extra space from a string of css.
Install
npm i minify-css-string
Usage
import { default as minifyCssString } from 'minify-css-string'
const cssString = `
@-webkit-keyframes react-fade-in {
0% { opacity: 0; }
50% { opacity: 0; }
100% { opacity: 1; }
}
@-moz-keyframes react-fade-in {
0% { opacity: 0; }
50% { opacity: 0; }
100% { opacity: 1; }
}
@-ms-keyframes react-fade-in {
0% { opacity: 0; }
50% { opacity: 0; }
100% { opacity: 1; }
}
@keyframes react-fade-in {
0% { opacity: 0; }
50% { opacity: 0; }
100% { opacity: 1; }
}
`
<style>
{minifyCssString(cssString)}
</style>
/* minifyCssString(cssString) === `@-webkit-keyframes react-fade-in { 0% { opacity: 0; } 50% { opacity: 0; } 100% { opacity: 1; } } @-moz-keyframes react-fade-in { 0% { opacity: 0; } 50% { opacity: 0; } 100% { opacity: 1; } } @-ms-keyframes react-fade-in { 0% { opacity: 0; } 50% { opacity: 0; } 100% { opacity: 1; } } @keyframes react-fade-in { 0% { opacity: 0; } 50% { opacity: 0; } 100% { opacity: 1; } }` */
Contributing
Contributions welcome! Please read the contributing guidelines first.