Permalink
Browse files

Moved core files into a vendor named directory for PSR-0 compliance.

Moved license and version out of the bootstrap file.
  • Loading branch information...
1 parent faefc01 commit 05416547984f740beae543a7d58f04eb5c3f378a @peteboere committed Jan 11, 2013
View
@@ -114,7 +114,7 @@
; <flex> shorthand.
;
; Support for the early 2012 syntax implemented in IE10 is achieved here in part with
- ; property aliases, and in part with property/value aliases later in this file.
+ ; property aliases, and in part with declaration aliases later in this file.
;
align-content[] = -webkit-align-content
align-items[] = -webkit-align-items
View
@@ -3,43 +3,55 @@
* Added flexbox aliases for both 2009 and 2012 edition specs.
* Added a legacy-flexbox plugin for auto-generating the flexbox 2009 spec equivilant properties.
* Updated selector aliases to take arguments at runtime.
-* Updated plugin API to use distinct 'enable' and 'disable' handlers.
-* The disable option is now resolved before the enable option so you can easily disable all plugins
+* Updated plugin API to use distinct "enable" and "disable" handlers.
+* `disable` option is now resolved before the `enable` option so you can easily disable all plugins
and then specify the plugins you want to apply.
* Added functions API for defining custom functions inside plugins.
-* Improved gradient function aliasing to handle new angle keywords ('to left', 'at center' etc.).
+* Improved gradient function aliasing to handle new angle keywords (to left, at center, etc.).
* Added svg-gradients plugin for simulating CSS3 gradients with data-uris.
-* Added formatting option so custom formatters can be defined for un-minified output (see wiki for options).
-* Added newlines option to force the style of newlines in output (see wiki for options).
+* Added `formatting` option for un-minified output. Possible values (custom formatters can also be defined):
+ * "block" (default) - Rules are block formatted.
+ * "single-line" - Rules are printed in single lines.
+ * "padded" - Rules are printed in single lines with right padded selectors.
+ Custom formatters can also be defined.
+* Added `newlines` option to set the style of newlines in output. Possible values:
+ * "use-platform" (default)
+ * "unix"
+ * "windows" or "win"
* Updated command line utility to use the new options.
-* Property/value aliases renamed as declaration aliases.
+* Property/value aliases expanded and renamed as declaration aliases.
* Classes now loaded via an autoloader, also some other refactoring for moving towards PSR-0 compliance.
1.8 (13th November 2012)
---
-* Added selector aliasing with the @selector-alias directive.
-* Added output_dir option for specifying the destination of compiled files.
-* Added doc_root option for working around problems with server aliases or path rewrites.
+* Added selector aliasing with the `@selector-alias` directive.
+* Added `output_dir` option for specifying the destination of compiled files.
+* Added `doc_root` option for working around problems with server aliases or path rewrites.
* Added viewport @-rule aliases.
-* Debug option renamed to 'minify'; debug option will still work as before but is deprecated.
-* New minify option optionally takes an array of advanced minification parameters.
-* Expanded trace option to take an optional array of log parameters;
-* log params available are stubs, selector_count, errors and compile_time.
-* Added CssCrush::stat method to retrieve logged parameters.
+* `debug` option renamed to `minify`; `debug` option will still work as before but is deprecated.
+* `minify` option takes an optional array of advanced minification parameters. Possible values:
+ * `colors`
+* Expanded `trace` option to take an optional array of log parameters. Possible values:
+ * `stubs`
+ * `selector_count`
+ * `errors`
+ * `compile_time`
+* Added `CssCrush::stat` method to retrieve logged parameters.
* Improved cross OS support.
* Improved minification.
* Major refactoring.
1.7 (28th September 2012)
---
-* Added trace option to output SASS compatible debug-info stubs for use with tools like FireSass.
-* Added @ifdefine directive for dynamically including/excluding parts of a CSS file based on the existence of variables.
+* Added `trace` option to output SASS compatible debug-info stubs for use with tools like FireSass.
+* Added `@ifdefine` directive for dynamically including/excluding parts of a CSS file based on the
+ existence of variables.
* Updated plugin API.
* Added options for enabling and disabling plugins at runtime.
* Added property sorter plugin.
* Added support for SASS-like @include/@extend syntax for invoking mixins and extends.
* Boilerplate option now accepts a filename string as a boilerplate template.
-* CssCrush::string method now uses document_root as a default context for finding linked resources.
+* `CssCrush::string` method now uses document\_root as a default context for finding linked resources.
* Updated command line appication.
* Updated aliases and initial value files.
* Fixed parsing issue introduced in 1.6.1.
@@ -51,14 +63,14 @@
1.6 (1st August 2012)
---
* Inheritance model improved to support adoption of pseudo classes and elements (see wiki).
-* Added rule self-referencing function this() and complimentary data-- properties.
-* Added rule referencing function query().
+* Added rule self-referencing function `this()` and complimentary data-* properties.
+* Added rule referencing function `query()`.
* Added default value argument for variables.
-* Added hsl-adjust() and hsla-adjust() color functions.
-* Mixin and fragment arg() function can now be nested.
+* Added `hsl-adjust()` and `hsla-adjust()` color functions.
+* Mixin and fragment `arg()` function can now be nested.
* Commas are now optional when specifying arguments for most custom functions.
* Double-colon plugin moved to core.
-* Option rewrite_import_urls now defaults to true.
+* Option `rewrite_import_urls` now defaults to true.
1.5.3 (13th June 2012)
-----
@@ -68,7 +80,7 @@
1.5.2 (8th June 2012)
-----
* Resolved issue #32.
-* CssCrush::inline method now defaults to not printing a boilerplate.
+* `CssCrush::inline` method now defaults to not printing a boilerplate.
* Updated aliases file.
1.5.1 (1st June 2012)
@@ -85,7 +97,7 @@
* Abstracted IO interface.
* Added some error reporting.
* Added spiffing.css plugin.
-* csscrush_tag method now uses media type 'all' by default.
+* `CssCrush::tag` method now uses media type 'all' by default.
* Updated alias and initial-value tables.
* Internal refactoring.
* Resolved issues #23, #24, #27, #28 and #29.
@@ -98,20 +110,20 @@
1.4.1 (10th February 2012)
-----
* Added command line application.
-* Added 'rewrite_import_urls' option - Ability to rewrite relative url references inside imported css files.
+* Added `rewrite_import_urls` option - Ability to rewrite relative url references inside imported css files.
* Added Prepend.css - Optionally prepend css to every input.
* Fix for issue #21.
* Reorganized aliases file with some additions.
* Initial-values updated.
-* Updated CssCrush::string method to correctly handle import statements.
+* Updated `CssCrush::string` method to correctly handle import statements.
1.4 (24th January 2012)
---
* Added initial-keyword plugin (shim for the CSS3 keyword).
* Added inline method (Issue #18).
* Added ability to escape declarations from aliasing or plugins by prefixing with tilde.
* Added procedural style public API to mirror the static class API.
-* Deprecated @variables syntax for @define. @variables still supported.
+* Deprecated `@variables` directive for `@define`. @variables still supported for next few releases.
* Adjusted color functions to accept a space delimiter (as well as comma) in the arguments list.
* Surpressed some benign PHP warning messages.
* Some internal cleaning up.
@@ -120,7 +132,7 @@
1.3.6 (9th November 2011)
-----
* Improved color functions.
-* Added a-adjust function for altering a color's opacity.
+* Added `a-adjust()` function for altering a color's opacity.
* Deprecated hsl-adjust function (you can use nested color functions instead).
* Added the ability to use local versions of alias and plugin files so pull updates don't clobber local settings.
@@ -158,7 +170,7 @@
1.3 (20th September 2011)
---
-* Added the public function CssCrush::string for processing raw strings of CSS.
+* Added the public function `CssCrush::string` for processing raw strings of CSS.
* Added color functions.
* Added aliases for IE10.
@@ -170,7 +182,7 @@
---
* Added support for global variables.
* Added support for variable interpolation within string literals.
-* Added 'tag' method for outputting an html link tag instead of returning a filename.
+* Added `CssCrush::tag` method for outputting an html link tag instead of returning a filename.
* Added values aliases, dynamic 'runtime' variables.
* Added RGBA macro.
* Added IE clip macro.
View
@@ -1,24 +1,18 @@
<?php
/**
- *
- * CSS Crush
- * Extensible CSS preprocessor.
- *
- * @version 1.9
- * @link https://github.com/peteboere/css-crush
- * @license http://www.opensource.org/licenses/mit-license.php (MIT)
- * @copyright (c) 2010-2013 Pete Boere
- */
-
+ *
+ * Bootstrap file with autoloader.
+ *
+ */
function csscrush_autoload ( $class ) {
// Only autoload classes with the library prefix.
if ( stripos( $class, 'csscrush' ) !== 0 ) {
return;
}
- $class = ltrim( substr( $class, 8 ), '_' );
- // Tolerate some cases of lowercasing from external use.
+ // Tolerate some cases of lowercasing.
+ $class = str_ireplace( 'csscrush', 'CssCrush', $class );
$subpath = implode( '/', array_map( 'ucfirst', explode( '_', $class ) ) );
require_once dirname( __FILE__ ) . "/lib/$subpath.php";
@@ -27,7 +21,6 @@ function csscrush_autoload ( $class ) {
spl_autoload_register( 'csscrush_autoload' );
-// Core.php will also be PSR-0 autoloaded with API changes in v2.x
-require_once 'lib/Core.php';
-
-CssCrush::init( __FILE__ );
+// Core.php will also be autoloaded with API changes in v2.x.
+require_once 'lib/CssCrush/Core.php';
+require_once 'lib/functions.php';
View
@@ -1,4 +1,4 @@
-Copyright (c) 2010-2012 Pete Boere
+Copyright (c) 2010-2013 Pete Boere
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
View
@@ -38,5 +38,4 @@ to every output file.
serif: $( times );
sans-serif: $( arial );
monospace: $( courier );
-
}
@@ -18,7 +18,7 @@ class CssCrush_ArgList implements Countable
public function __construct ( $str )
{
// Parse all arg function calls in the passed string, callback creates default values
- CssCrush_Function::executeCustomFunctions( $str,
+ CssCrush_Function::executeOnString( $str,
CssCrush_Regex::$patt->argFunction, array(
'arg' => array( $this, 'store' )
));
File renamed without changes.
File renamed without changes.
@@ -6,24 +6,24 @@
*/
class CssCrush
{
+ const VERSION = '1.9';
+
// Global settings.
static public $config;
// The current active process.
static public $process;
// Init called once manually post class definition.
- static public function init ( $seed_file )
+ static public function init ()
{
self::$config = new stdclass();
- // Path to this installation.
- self::$config->location = dirname( $seed_file );
+ // Path to the project root folder.
+ self::$config->location = dirname(dirname(dirname(__FILE__)));
- // Get version ID from seed file.
- $seed_file_contents = file_get_contents( $seed_file );
- $match_count = preg_match( '~@version\s+([\d\.\w-]+)~', $seed_file_contents, $version_match );
- self::$config->version = $match_count ? new CssCrush_Version( $version_match[1] ) : null;
+ // Establish version id.
+ self::$config->version = new CssCrush_Version( self::VERSION );
// Set the docRoot reference.
self::setDocRoot();
@@ -90,14 +90,6 @@ static public function init ( $seed_file )
// Include and register stock formatters.
require_once self::$config->location . '/misc/formatters.php';
-
- // Include the procedural API functions.
- require_once self::$config->location . '/misc/functions.php';
-
- // Initialise other classes.
- CssCrush_Regex::init();
- CssCrush_Function::init();
- CssCrush_PostAliasFix::init();
}
static protected function setDocRoot ( $doc_root = null )
@@ -545,3 +537,5 @@ static public function runStat ( $name )
}
}
}
+
+CssCrush::init();
@@ -27,6 +27,7 @@ public function __construct ( $prop, $value, $contextIndex = 0 )
// Check the input.
if ( $prop === '' || $value === '' || $value === null ) {
$this->isValid = false;
+
return;
}
@@ -55,12 +56,13 @@ public function __construct ( $prop, $value, $contextIndex = 0 )
// Ignore declarations with null css values.
if ( $value === false || $value === '' ) {
$this->isValid = false;
+
return;
}
// Apply custom functions.
if ( ! $skip ) {
- CssCrush_Function::executeCustomFunctions( $value );
+ CssCrush_Function::executeOnString( $value );
}
// Capture all remaining paren pairs.
File renamed without changes.
File renamed without changes.
@@ -30,7 +30,7 @@ static public function setMatchPatt ()
self::$functionPatt = CssCrush_Regex::createFunctionMatchPatt( array_keys( self::$customFunctions ), true );
}
- static public function executeCustomFunctions ( &$str, $patt = null, $process_callback = null, $property = null )
+ static public function executeOnString ( &$str, $patt = null, $process_callback = null, $property = null )
{
// No bracketed expressions, early return.
if ( false === strpos( $str, '(' ) ) {
@@ -217,3 +217,5 @@ function csscrush_fn__a_adjust ( $input ) {
list( $color, $a ) = array_pad( CssCrush_Function::parseArgs( $input, true ), 2, 0 );
return CssCrush_Function::colorAdjust( $color, array( 0, 0, 0, $a ) );
}
+
+CssCrush_Function::init();
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
@@ -114,3 +114,4 @@ function csscrush__post_alias_fix_radialgradients ( $declaration_copies, $fn_nam
}
}
+CssCrush_PostAliasFix::init();
@@ -484,7 +484,7 @@ protected function calculateVariables ()
// Variable values can be escaped from function parsing with a tilde prefix.
if ( strpos( $value, '~' ) !== 0 ) {
- CssCrush_Function::executeCustomFunctions( $value );
+ CssCrush_Function::executeOnString( $value );
}
}
}
@@ -519,7 +519,7 @@ static protected function placeVariables ( &$value )
if ( strpos( $value, '$(' ) !== false ) {
// Variables with default value.
- CssCrush_Function::executeCustomFunctions( $value, $regex->varFunctionStart,
+ CssCrush_Function::executeOnString( $value, $regex->varFunctionStart,
array( '$' => array( 'CssCrush_Process', 'cb_placeVariablesWithDefault' ) ) );
// Assume at least 1 replace.
@@ -735,7 +735,7 @@ protected function processRules ()
$rule->addFunctionAliases();
}
if ( $aliases[ 'declarations' ] ) {
- $rule->addPropertyValueAliases();
+ $rule->addDeclarationAliases();
}
CssCrush_Hook::run( 'rule_postalias', $rule );
@@ -119,3 +119,6 @@ static public function createFunctionMatchPatt ( $list, $include_math_function =
return '~(?<![\w-])(' . implode( '|', $list ) . ')' . $question . '\(~iS';
}
}
+
+CssCrush_Regex::init();
+
Oops, something went wrong.

0 comments on commit 0541654

Please sign in to comment.