xref: /plugin/pagecss/vendor/csstidy-2.2.1/README.md (revision 7d6669007238fef7e8728f167d637ed824899eb0)
1# CSSTidy
2
3CSSTidy is a CSS minifier
4
5* css_optimiser.php is the web-interface
6* class.csstidy.php is the parser
7* bin/pcsstidy is the standalone command line executable
8
9This class represents a CSS parser which reads CSS code and saves it in an array.
10In opposite to most other CSS parsers, it does not use regular expressions and
11thus has full CSS3 support and a higher reliability. The downside of not using regular expressions
12is a lower speed though.
13Additional to that it applies some optimisations and fixes to the CSS code.
14
15## Usage
16
17```php
18include('class.csstidy.php');
19$csstidy = new csstidy();
20
21// Set some options :
22$csstidy->set_cfg('optimise_shorthands', 2);
23$csstidy->set_cfg('template', 'high');
24
25// Parse the CSS
26$csstidy->parse($css_code);
27
28// Get back the optimized CSS Code
29$css_code_opt = $csstidy->print->plain();
30```
31
32## Changelog
33
34* v2.2.0 :
35  * test suite switch to phpunit
36* v2.1.0 :
37  * fix issues with css4 colors
38* v2.0.0 :
39  * PHP 7.1 is the minimal version. Compatible PHP 8.0 and 8.1
40* v1.7.3 :
41  * fix bug and notice on reverse_left_and_right option
42* v1.7.1 :
43  * fix deprecated with PHP 7.4
44* v1.7.0 :
45  * provide bin/pcsstidy for command line usage
46  * support nested @media and @supports rules
47* v1.6.5 :
48  * fix warnings with PHP 7.3
49* v1.6.4 :
50  * preserve important comments (starting with !) in the minification `/*! Credits/Licence */`
51* v1.6.3 :
52  * border-radius shorthands optimisation, reverse_left_and_right option
53* v1.5.7 :
54  * PHP 7 compatibility, composer update, Travis CI integration
55* v1.5.6 :
56  * fixes minor bugs, mainly on CSS3 properties/units
57* v1.5.2 :
58  * is PHP 5.4+ compliant, removes use of GLOBALS, fixes some bugs, integrates CSS3 units
59  * and now available on <https://packagist.org/packages/cerdic/css-tidy>
60* v1.4 :
61  * Is the new version coming from master branch (corresponds to the initial trunk of svn repository) after beeing stabilized
62* v1.3 branch corresponds to the last stable relase published by the author.
63  * It integrates some bugfixes and a 1.3.1 version has been taged
64  * Since the original project (<http://csstidy.sourceforge.net/index.php>) has been suspended
65here is the import of <https://csstidy.svn.sourceforge.net/svnroot/csstidy> on 2010-11-14
66
67Only PHP version is here maintained
68
69## Licence
70
71>Copyright 2005-2007 Florian Schmitz
72>Copyright 2010-2019 Cedric Morin
73>
74>CSSTidy is free software; you can redistribute it and/or modify
75>it under the terms of the GNU Lesser General Public License as published by
76>the Free Software Foundation; either version 2.1 of the License, or
77>(at your option) any later version.
78>
79>CSSTidy is distributed in the hope that it will be useful,
80>but WITHOUT ANY WARRANTY; without even the implied warranty of
81>MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
82>GNU Lesser General Public License for more details.
83>
84>You should have received a copy of the GNU Lesser General Public License
85>along with this program.  If not, see <http://www.gnu.org/licenses/>.
86
87## History
88
89Original Tracker : <http://sourceforge.net/tracker/?group_id=148404&atid=771415>