All Projects → uncss → Postcss Uncss

uncss / Postcss Uncss

Licence: mit
Use uncss as a postcss plugin

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to Postcss Uncss

Postcss Elm Tailwind
put some tailwind in your elm
Stars: ✭ 80 (-23.81%)
Mutual labels:  postcss
Uncss
Remove unused styles from CSS
Stars: ✭ 9,170 (+8633.33%)
Mutual labels:  postcss
Rtlcss
Framework for transforming Cascading Style Sheets (CSS) from Left-To-Right (LTR) to Right-To-Left (RTL)
Stars: ✭ 1,363 (+1198.1%)
Mutual labels:  postcss
React Base
atSistemas React/Redux Isomorphic Platform
Stars: ✭ 82 (-21.9%)
Mutual labels:  postcss
Postcss Foft Classes
A postcss plugin to automatically add classes for various font loading strategies.
Stars: ✭ 87 (-17.14%)
Mutual labels:  postcss
Postcss Less
PostCSS Syntax for parsing LESS
Stars: ✭ 93 (-11.43%)
Mutual labels:  postcss
Postcss Sass
A Sass parser for PostCSS, using gonzales-pe. https://www.npmjs.com/package/postcss-sass
Stars: ✭ 76 (-27.62%)
Mutual labels:  postcss
Webpack4.x
webpack4.x详细配置步骤
Stars: ✭ 103 (-1.9%)
Mutual labels:  postcss
React Boilerplate
This project is deprecated. Please use CRA instead.
Stars: ✭ 88 (-16.19%)
Mutual labels:  postcss
Gridsome Plugin Tailwindcss
A Tailwind plugin for Gridsome.
Stars: ✭ 100 (-4.76%)
Mutual labels:  postcss
Lit Loader
LitElement Single File Component loader for Webpack.
Stars: ✭ 84 (-20%)
Mutual labels:  postcss
Postcss Grid Kiss
A PostCSS plugin to keep CSS grids stupidly simple
Stars: ✭ 1,270 (+1109.52%)
Mutual labels:  postcss
Shortstack
🥞 minimal Rollup + PostCSS modern syntax starter template
Stars: ✭ 94 (-10.48%)
Mutual labels:  postcss
Cessie
Transpile your CSS bundle to support CSS variables, calc, and future CSS for legacy browsers.
Stars: ✭ 81 (-22.86%)
Mutual labels:  postcss
Wordpressify
🎈 A build system designed to automate your WordPress development workflow.
Stars: ✭ 1,374 (+1208.57%)
Mutual labels:  postcss
Postcss Modules Example
How to use postcss-modules plugin
Stars: ✭ 78 (-25.71%)
Mutual labels:  postcss
Postcss Font Family System Ui
PostCSS plugin to transform W3C CSS font-family: system-ui to a practical font-family list
Stars: ✭ 91 (-13.33%)
Mutual labels:  postcss
Postcss Pxtorem
Convert pixel units to rem (root em) units using PostCSS
Stars: ✭ 1,592 (+1416.19%)
Mutual labels:  postcss
Css In React
🍭 CSS in React - Learn the best CSS in JS frameworks by example
Stars: ✭ 101 (-3.81%)
Mutual labels:  postcss
Ember Cli Postcss
🔥 A Postcss integration for ember-cli
Stars: ✭ 97 (-7.62%)
Mutual labels:  postcss

postcss-uncss

npm npm

Use uncss as a PostCSS plugin.

About

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

Example:

html:

<body>
  <p class="red">Hello World!</p>
</body>

css before:

.red {
  color: red;
}
.blue {
  color: blue;
}

css after:

.red {
  color: red;
}

How?

The HTML files are loaded by jsdom and JavaScript is executed. UnCSS filters out selectors that are not found in the HTML files.

See the UnCSS docs for more information.

Installation

postcss-uncss specifies UnCSS as a peerDependency, so you will have to install UnCSS as well.

npm install postcss-uncss uncss

postcss-uncss' MAJOR & MINOR version numbers correspond to UnCSS' version numbers; however, the PATCH version number may differ.

Usage

postcss([ require('postcss-uncss') ])

See PostCSS docs for examples for your environment.

Options

  • html (Array): provide a list of html files to parse for selectors and elements. Usage of globs is allowed.

  • ignore (Array): provide a list of selectors that should not be removed by UnCSS. For example, styles added by user interaction with the page (hover, click), since those are not detectable by UnCSS yet. Both literal names and regex patterns are recognized. Otherwise, you can add a comment before specific selectors in your css:

    /* uncss:ignore */
    .selector1 {
        /* this rule will be ignored */
    }
    
    .selector2 {
        /* this will NOT be ignored */
    }
    

Example Configuration

{
  html: ['index.html', 'about.html', 'team/*.html'],
  ignore: ['.fade']
}
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].