1# CSSTidy [![Build Status](https://travis-ci.org/Cerdic/CSSTidy.svg?branch=master)](https://travis-ci.org/Cerdic/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
16## Usage
17
18```
19include('class.csstidy.php');
20$csstidy = new csstidy();
21
22// Set some options :
23$csstidy->set_cfg('optimise_shorthands', 2);
24$csstidy->set_cfg('template', 'high');
25
26// Parse the CSS
27$csstidy->parse($css_code);
28
29// Get back the optimized CSS Code
30$css_code_opt = $csstidy->print->plain();
31```
32
33
34## Changelog
35* v1.7.3 :
36  - fix bug and notice on reverse_left_and_right option
37* v1.7.1 :
38  - fix deprecated with PHP 7.4
39* v1.7.0 :
40  - provide bin/pcsstidy for command line usage
41  - support nested @media and @supports rules
42* v1.6.5 :
43  - fix warnings with PHP 7.3
44* v1.6.4 :
45  - preserve important comments (starting with !) in the minification /*! Credits/Licence */
46* v1.6.3 :
47  - border-radius shorthands optimisation, reverse_left_and_right option
48* v1.5.7 :
49  - PHP 7 compatibility, composer update, Travis CI integration
50* v1.5.6 :
51  - fixes minor bugs, mainly on CSS3 properties/units
52* v1.5.2 :
53  - is PHP 5.4+ compliant, removes use of GLOBALS, fixes some bugs, integrates CSS3 units
54  - and now available on https://packagist.org/packages/cerdic/css-tidy
55* v1.4 :<br/>
56Is the new version coming from master branch (corresponds to the initial trunk of svn repository) after beeing stabilized
57* v1.3 branch corresponds to the last stable relase published by the author.<br/>
58It integrates some bugfixes and a 1.3.1 version has been taged
59Since the original project (http://csstidy.sourceforge.net/index.php) has been suspended
60here is the import of https://csstidy.svn.sourceforge.net/svnroot/csstidy on 2010-11-14
61
62Only PHP version is here maintained
63
64## Licence
65
66	Copyright 2005-2007 Florian Schmitz
67	Copyright 2010-2019 Cedric Morin
68
69	CSSTidy is free software; you can redistribute it and/or modify
70	it under the terms of the GNU Lesser General Public License as published by
71	the Free Software Foundation; either version 2.1 of the License, or
72	(at your option) any later version.
73
74	CSSTidy is distributed in the hope that it will be useful,
75	but WITHOUT ANY WARRANTY; without even the implied warranty of
76	MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
77	GNU Lesser General Public License for more details.
78
79	You should have received a copy of the GNU Lesser General Public License
80	along with this program.  If not, see <http://www.gnu.org/licenses/>.
81
82
83## History
84
85Original Tracker :
86http://sourceforge.net/tracker/?group_id=148404&atid=771415
87