Skip to content

PostCss plugin to minify your CSS with clean-css

License

Notifications You must be signed in to change notification settings

chariz/postcss-clean

This branch is 32 commits ahead of, 2 commits behind leodido/postcss-clean:master.

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Jun 14, 2023
a69e2cc · Jun 14, 2023
Feb 7, 2021
Mar 4, 2016
Apr 19, 2016
Apr 19, 2016
Jun 2, 2023
Feb 7, 2021
Feb 7, 2021
Feb 7, 2021
Feb 7, 2021
Nov 24, 2021
Feb 7, 2021
Jun 14, 2023
Jun 14, 2023
Nov 24, 2021
Nov 24, 2021

Repository files navigation

postcss-clean GitHub Workflow Status (branch) NPM Coveralls branch NPM Monthly Downloads

PostCss plugin to minify your CSS

Compression will be handled by clean-css, which according to this benchmark is one of the top (probably the best) libraries for minifying CSS.

Install

With npm do:

npm install postcss-clean --save

Example

Input 1

.try {
  color: #607d8b;
  width: 32px;
}

Output 1

.try{color:#607d8b;width:32px}

Input 2

:host {
  display: block;
}

:host ::content {
  & > * {
    color: var(--primary-color);
  }
}

Output 2

:host{display:block}:host ::content>*{color:var(--my-color)}

Note this example assumes you combined postcss-clean with other plugins (e.g. postcss-nesting).

API

clean([options])

Note that postcss-clean is an asynchronous processor. It cannot be used like this:

var out = postcss([ clean() ]).process(css).css;
console.log(out)

Instead make sure your runner uses the async APIs:

postcss([ clean() ]).process(css).then(function(out) {
    console.log(out.css);
});

options

It simply proxies the clean-css options. See the complete list of options here.

Usage

See the PostCSS documentation for examples for your environment.

Contributing

Pull requests are welcome.

License

MIT © Leonardo Di Donato


Analytics

About

PostCss plugin to minify your CSS with clean-css

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • JavaScript 100.0%