nursit / pouet-core
随机 pouet 组件包核心
v1.0.2
2023-07-26 12:30 UTC
Requires
- php: ^7.1 || ^8
Requires (Dev)
- simpletest/simpletest: dev-master
README
CSSTidy 是一个 CSS 压缩工具
- css_optimiser.php 是网页界面
- class.csstidy.php 是解析器
- bin/pcsstidy 是独立的命令行可执行文件
此类代表一个 CSS 解析器,它读取 CSS 代码并将其保存到数组中。与大多数其他 CSS 解析器不同,它不使用正则表达式,因此具有完整的 CSS3 支持和更高的可靠性。然而,不使用正则表达式的缺点是速度较慢。除此之外,它还对 CSS 代码应用了一些优化和修复。
使用方法
include('class.csstidy.php');
$csstidy = new csstidy();
// Set some options :
$csstidy->set_cfg('optimise_shorthands', 2);
$csstidy->set_cfg('template', 'high');
// Parse the CSS
$csstidy->parse($css_code);
// Get back the optimized CSS Code
$css_code_opt = $csstidy->print->plain();
变更日志
- v2.0.0
- PHP 7.1 是最低版本。兼容 PHP 8.0 和 8.1
- v1.7.3
- 修复了关于 reverse_left_and_right 选项的 bug 和 notice
- v1.7.1
- 修复了 PHP 7.4 中弃用的功能
- v1.7.0
- 提供 bin/pcsstidy 以供命令行使用
- 支持嵌套 @media 和 @supports 规则
- v1.6.5
- 修复了 PHP 7.3 中的警告
- v1.6.4
- 在压缩时保留重要的注释(以 ! 开头)/! 信用/Licence/
- v1.6.3
- border-radius 简写优化,reverse_left_and_right 选项
- v1.5.7
- PHP 7 兼容性,composer update,Travis CI 集成
- v1.5.6
- 修复了主要针对 CSS3 属性/单位的少量 bug
- v1.5.2
- 符合 PHP 5.4+ 规范,移除了 GLOBALS 的使用,修复了一些 bug,集成了 CSS3 单位
- 现在可在 https://packagist.org.cn/packages/cerdic/css-tidy 上找到
- v1.4 :<br/> 这是来自 master 分支的新版本(对应于 svn 存储库的初始 trunk)在稳定后
- v1.3 分支对应于作者发布的最后一个稳定版本。<br/> 它集成了某些 bug 修复和一个 1.3.1 版本被标记。由于原始项目 (http://csstidy.sourceforge.net/index.php) 已暂停,这里是在 2010-11-14 上的 https://csstidy.svn.sourceforge.net/svnroot/csstidy 的导入
这里只维护 PHP 版本
许可证
Copyright 2005-2007 Florian Schmitz
Copyright 2010-2019 Cedric Morin
CSSTidy is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 2.1 of the License, or
(at your option) any later version.
CSSTidy is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with this program. If not, see <https://gnu.ac.cn/licenses/>.
历史
原始追踪器 : http://sourceforge.net/tracker/?group_id=148404&atid=771415