UnCSS icon
UnCSS icon

UnCSS

UnCSS is a tool that removes unused CSS from your stylesheets. It works across multiple files and supports Javascript-injected CSS.

Cost / License

  • Free
  • Open Source

Platforms

  • Self-Hosted
  • CSS
-
No reviews
0likes
0comments
0news articles

Features

Suggest and vote on features
No features, maybe you want to suggest one?

 Tags

UnCSS News & Activities

Highlights All activities

Recent activities

No activities found.

UnCSS information

  • Developed by

    Giacomo Martino
  • Licensing

    Open Source (MIT) and Free product.
  • Written in

  • Alternatives

    5 alternatives listed
  • Supported Languages

    • English

AlternativeTo Category

Development

GitHub repository

  •  9,423 Stars
  •  406 Forks
  •  58 Open Issues
  •   Updated  
View on GitHub

Popular alternatives

View all
UnCSS was added to AlternativeTo by Paul on and this page was last updated .
No comments or reviews, maybe you want to be first?
Post comment/review

What is UnCSS?

UnCSS is a tool that removes unused CSS from your stylesheets. It works across multiple files and supports Javascript-injected CSS.

How?

The process by which UnCSS removes the unused rules is as follows:

  1. The HTML files are loaded by jsdom and JavaScript is executed.
  2. All the stylesheets are parsed by PostCSS.
  3. document.querySelector filters out selectors that are not found in the HTML files.
  4. The remaining rules are converted back to CSS.

Please note:

• UnCSS cannot be run on non-HTML pages, such as templates or PHP files. If you need to run UnCSS against your templates, you should probably generate example HTML pages from your templates, and run uncss on those generated files; or run a live local dev server, and point uncss at that. • UnCSS only runs the Javascript that is run on page load. It does not (and cannot) handle Javascript that runs on user interactions like button clicks. You must use the ignore option to preserve classes that are added by Javascript on user interaction.

Official Links