https://github.com/bentatum/minify-css-string
Remove new lines and extra space from a string of css.
https://github.com/bentatum/minify-css-string
Last synced: 10 days ago
JSON representation
Remove new lines and extra space from a string of css.
- Host: GitHub
- URL: https://github.com/bentatum/minify-css-string
- Owner: bentatum
- License: isc
- Created: 2016-07-12T21:21:45.000Z (almost 9 years ago)
- Default Branch: master
- Last Pushed: 2016-07-12T21:27:08.000Z (almost 9 years ago)
- Last Synced: 2025-04-16T02:49:06.337Z (about 1 month ago)
- Language: JavaScript
- Size: 3.91 KB
- Stars: 13
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Contributing: CONTRIBUTING.md
- License: LICENSE.md
Awesome Lists containing this project
README
# minify-css-string
[![npm][npm-image]][npm-url]
[![travis][travis-image]][travis-url]
[![standard][standard-image]][standard-url][npm-image]: https://img.shields.io/npm/v/minify-css-string.svg?style=flat-square
[npm-url]: https://www.npmjs.com/package/minify-css-string
[travis-image]: https://img.shields.io/travis/bentatum/minify-css-string.svg?style=flat-square
[travis-url]: https://travis-ci.org/bentatum/minify-css-string
[standard-image]: https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat-square
[standard-url]: http://npm.im/standardRemove new lines and extra space from a string of css.
## Install
```
npm i minify-css-string
```## Usage
```js
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; }
}
`{minifyCssString(cssString)}
/* 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](CONTRIBUTING.md) first.
## License
[ISC](LICENSE.md)