unused css,Remove unused CSS

PurgeCSS

8e872b3d8e0329db24f2637b65c8613d.png

What is PurgeCSS?

When you are building a website, chances are that you are using a css framework like Bootstrap, Materializecss, Foundation, etc... But you will only use a small set of the framework and a lot of unused css styles will be included.

This is where PurgeCSS comes into play. PurgeCSS analyzes your content and your css files. Then it matches the selectors used in your files with the one in your content files. It removes unused selectors from your css, resulting in smaller css files.

Version 1

If you are looking for PurgeCSS 1 , the documentation is here

Documentation

You can find the PurgeCSS documentation on this website .

Table of Contents

PurgeCSS

Plugins

Guides

Getting Started

Installation

npm i --save-dev purgecss

Usage

import PurgeCSS from 'purgecss'

const purgeCSSResults = await new Purgecss().purge({

content: ['**/*.html'],

css: ['**/*.css']

})

Packages

This repository is a monorepo that we manage using Lerna . That means that we actually publish several packages to npm from the same codebase, including:

Package

Version

Description

The core of PurgeCSS

PostCSS plugin for PurgeCSS

Webpack plugin for PurgeCSS

Gulp plugin for PurgeCSS

Grunt plugin for PurgeCSS

Html extractor for PurgeCSS

Js extractor for PurgeCSS

Pug extractor for PurgeCSS

Collection of whitelist items for WordPress

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值