MyIntervals / PHP-CSS-Parser

A Parser for CSS Files written in PHP. Allows extraction of CSS files into a data structure, manipulation of said structure and output as (optimized) CSS

Home Page:http://www.sabberworm.com/blog/2010/6/10/php-css-parser

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Require? Include?

neotropic2023 opened this issue · comments

To read a file, for example, you’d do the following:

REQUIRE('......................................'); <-- And what file do we call?

$oCssParser = new Sabberworm\CSS\Parser(file_get_contents('somefile.css'));
$oCssDocument = $oCssParser->parse();

If you installed with composer, you’ll want to require 'vendor/autoload.php'; (see the docs).

You can also use this as a simple psr-0 class loader

<?php
set_include_path('DIR_STRUCTURE' . '/PHP-CSS-Parser/lib/');
spl_autoload_register(function ($class) {
  $file = preg_replace('#\\\|_(?!.+\\\)#','/', $class) . '.php';
  if (stream_resolve_include_path($file)) {
    require $file;
  }
});
?>