1 # CSSTidy [![Build Status](https://travis-ci.org/Cerdic/CSSTidy.svg?branch=master)](https://travis-ci.org/Cerdic/CSSTidy)
3 CSSTidy is a CSS minifier
5 * css_optimiser.php is the web-interface
6 * class.csstidy.php is the parser
7 * bin/pcsstidy is the standalone command line executable
9 This class represents a CSS parser which reads CSS code and saves it in an array.
10 In opposite to most other CSS parsers, it does not use regular expressions and
11 thus has full CSS3 support and a higher reliability. The downside of not using regular expressions
12 is a lower speed though.
13 Additional to that it applies some optimisations and fixes to the CSS code.
19 include('class.csstidy.php');
20 $csstidy = new csstidy();
23 $csstidy->set_cfg('optimise_shorthands', 2);
24 $csstidy->set_cfg('template', 'high');
27 $csstidy->parse($css_code);
29 // Get back the optimized CSS Code
30 $css_code_opt = $csstidy->print->plain();
36 - fix bug and notice on reverse_left_and_right option
38 - fix deprecated with PHP 7.4
40 - provide bin/pcsstidy for command line usage
41 - support nested @media and @supports rules
43 - fix warnings with PHP 7.3
45 - preserve important comments (starting with !) in the minification /*! Credits/Licence */
47 - border-radius shorthands optimisation, reverse_left_and_right option
49 - PHP 7 compatibility, composer update, Travis CI integration
51 - fixes minor bugs, mainly on CSS3 properties/units
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
56 Is 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/>
58 It integrates some bugfixes and a 1.3.1 version has been taged
59 Since the original project (http://csstidy.sourceforge.net/index.php) has been suspended
60 here is the import of https://csstidy.svn.sourceforge.net/svnroot/csstidy on 2010-11-14
62 Only PHP version is here maintained
66 Copyright 2005-2007 Florian Schmitz
67 Copyright 2010-2019 Cedric Morin
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.
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.
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/>.
86 http://sourceforge.net/tracker/?group_id=148404&atid=771415