Get unlimited public & private packages + package-based permissions with npm Pro.Get started »

css-flatten

1.0.1 • Public • Published

CSS Flatten

Flattens a nested (S)CSS string, & placeholders are supported too.

This is implemented using css-simple-parser, which makes it tiny and blazing fast, but there are some limitations to be aware of, read the parser's readme to learn about them.

Install

npm install --save css-flatten

Usage

import flatten from 'css-flatten';
 
const css = `
.foo {
  color: red;
  &:hover {
    color: green;
  }
  .bar {
    color: blue;
  }
}
`;
 
flatten ( css ); // =>
// .foo {
//   color: red;
// }
// .foo:hover {
//   color: green;
// }
// .foo .bar {
//   color: blue;
// }

License

MIT © Fabio Spampinato

Install

npm i css-flatten

DownloadsWeekly Downloads

3

Version

1.0.1

License

MIT

Unpacked Size

19.7 kB

Total Files

14

Last publish

Collaborators

  • avatar