You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
bin/pcsstidy is the standalone command line executable
This class represents a CSS parser which reads CSS code and saves it in an array.
In opposite to most other CSS parsers, it does not use regular expressions and
thus has full CSS3 support and a higher reliability. The downside of not using regular expressions
is a lower speed though.
Additional to that it applies some optimisations and fixes to the CSS code.
Usage
include('class.csstidy.php');
$csstidy = newcsstidy();
// 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();
Changelog
v2.2.0 :
test suite switch to phpunit
v2.1.0 :
fix issues with css4 colors
v2.0.0 :
PHP 7.1 is the minimal version. Compatible PHP 8.0 and 8.1
v1.7.3 :
fix bug and notice on reverse_left_and_right option
v1.7.1 :
fix deprecated with PHP 7.4
v1.7.0 :
provide bin/pcsstidy for command line usage
support nested @media and @supports rules
v1.6.5 :
fix warnings with PHP 7.3
v1.6.4 :
preserve important comments (starting with !) in the minification /*! Credits/Licence */
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 http://www.gnu.org/licenses/.