DropCSS

编程之家收集整理的这个编程导航主要介绍了DropCSS编程之家,现在分享给大家,也给大家做个参考。

DropCSS

DropCSS 介绍

Dropcss 是一个用来清理无用 css 的小工具,它根据 html 和 css 作为输入并返回那些有用到的 css 信息。 Dropcss删除所有未使用的样式块、重复的选择器、@keyframes等等。高度优化,速度极快。 

Dropcss安装

npm install -D dropcss

Dropcss使用方法:  

const dropcss = require('dropcss');

let html = `

<html>

<head></head>

<body>

<p>Hello World!</p>

</body>

</html>

`;

let css = `

.card {

padding: 8px;

}

p:hover a:first-child {

color: red;

}

`;

const whitelist = /#foo|.bar/;

let dropped = new Set();

let cleaned = dropcss({

html,

css,

shouldDrop: (sel) => {

if (whitelist.test(sel))

return false;

else {

dropped.add(sel);

return true;

}

},

});

console.log(cleaned.css);

console.log(dropped);

GitHub:https://github.com/leeoniya/dropcss

网站描述:一个用来清理无用 CSS 的小工具

DropCSS官方网站

官方网站:

如果觉得编程之家网站内容还不错,欢迎将编程之家网站推荐给程序员好友。

相关文章

Basscss,一个CSS重置,网格系统、颜色类、实用类等来帮助你建...
sandal,Sass 的基础库
CssLoad,完全基于CSS的加载动画设计工具
tachyons,轻便实用的 css 框架
CssDeck,在线CSS代码编辑器及共享网
Pure.css,雅虎出品的一组轻量级、响应式纯css模块