Node.JS的CSS压缩器 clean-css
- 授权协议: MIT
- 开发语言: JavaScript
- 操作系统: 跨平台
- 软件首页: https://github.com/GoalSmashers/clean-css
软件介绍
clean-css 是一个非常简单的 CSS 压缩程序,可以删除 CSS 中一些无用的空格、评论以及每个选择器后面的分号等。
在命令行中的使用方法:
cleancss -o style.min.css style.css
cat theme.css feature1.css feature2.css feature3.css | cleancss -o features.css
cat theme.css feature1.css | cleancss | gzip -9 -c > feature1.css.gz
也可在 Node.js 中使用:
# Get the clean-css package var cleanCSS = require('clean-css'); # Read in the source of a file or use hard-coded CSS... var source = "body { color: red; font-weight: bold; }"; # Minify! var minifiedCSS = cleanCSS.process(source);
