GithubHelp home page GithubHelp logo

shapocc / csstidy Goto Github PK

View Code? Open in Web Editor NEW

This project forked from cerdic/csstidy

1.0 0.0 0.0 745 KB

CSSTidy is a CSS minifier

License: GNU Lesser General Public License v2.1

PHP 98.61% CSS 0.74% Smarty 0.65%

csstidy's Introduction

CSSTidy

CSSTidy is a CSS minifier

  • css_optimiser.php is the web-interface
  • class.csstidy.php is the parser
  • 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 = 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();

Changelog

  • 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 */
  • v1.6.3 :
    • border-radius shorthands optimisation, reverse_left_and_right option
  • v1.5.7 :
    • PHP 7 compatibility, composer update, Travis CI integration
  • v1.5.6 :
    • fixes minor bugs, mainly on CSS3 properties/units
  • v1.5.2 :
  • v1.4 :
    Is the new version coming from master branch (corresponds to the initial trunk of svn repository) after beeing stabilized
  • v1.3 branch corresponds to the last stable relase published by the author.
    It integrates some bugfixes and a 1.3.1 version has been taged Since the original project (http://csstidy.sourceforge.net/index.php) has been suspended here is the import of https://csstidy.svn.sourceforge.net/svnroot/csstidy on 2010-11-14

Only PHP version is here maintained

Licence

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 <http://www.gnu.org/licenses/>.

History

Original Tracker : http://sourceforge.net/tracker/?group_id=148404&atid=771415

csstidy's People

Contributors

amiga-500 avatar azettl avatar bytestream avatar cerdic avatar cfinke avatar christophwurst avatar claviska avatar dsferruzza avatar flug avatar jaydiablo avatar marcimat avatar need4video avatar nuxodin avatar phenix-factory avatar phpgangsta avatar richeryang avatar sunflowerfuchs avatar weikinhuang avatar

Stargazers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.