PyPI: https://pypi.org/project/cssmin/ Github: https://github.com/zacharyvoase/cssmin
安裝
pip install cssmin
使用示例
main.css
.box{
background-color: red;
}
1、指令行中使用
$ cat main.css | cssmin
.box{background-color:red}
2、代碼中使用
# -*- coding: utf-8 -*-
import cssmin
with open('main.css') as f:
output = cssmin.cssmin(f.read())
print(output)
# .box{background-color:red}