微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

clean-css Node.JS的CSS压缩器

程序名称:clean-css

授权协议: MIT

操作系统: 跨平台

开发语言: JavaScript

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);

clean-css 官网

https://github.com/GoalSmashers/clean-css

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。

相关推荐