Skip to content

Commit

Permalink
Changed CSS compressor to YUI CSS compressor
Browse files Browse the repository at this point in the history
The YUI CSS compressor is more wideley used and fixes some of the
reported issues with the previous compressor.
  • Loading branch information
hwmaier committed Feb 9, 2015
1 parent 2ca07a1 commit 5932081
Show file tree
Hide file tree
Showing 3 changed files with 787 additions and 379 deletions.
20 changes: 10 additions & 10 deletions AllInOneMinify.module
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ class AllInOneMinify extends WireData implements Module, ConfigurableModule {
// ------------------------------------------------------------------------
// Version: major, minor, revision, i.e. 100 = 1.1.0
// ------------------------------------------------------------------------
'version' => 314,
'version' => 320,

'author' => 'David Karich & Conclurer GbR',

Expand Down Expand Up @@ -532,14 +532,13 @@ class AllInOneMinify extends WireData implements Module, ConfigurableModule {
// ------------------------------------------------------------------------
// Load the css minimization Library
// ------------------------------------------------------------------------
// @version 1.1.2
// @license MIT License (MIT)
// @description CssMin is a css minfier. It minifies css by
// removing unneeded whitespace character, comments, empty
// blocks and empty declarations. In addition declaration
// values can get rewritten to shorter notation if available.
// @version 2.4.8-4
// @docs https://github.com/tubalmartin/YUI-CSS-compressor-PHP-port
// @license BSD (revised)
// @description PHP port of the CSS minification tool distributed with
// YUICompressor.
//------------------------------------------------------------------------
require_once(wire('config')->paths->AllInOneMinify.'lib'.DIRECTORY_SEPARATOR.'CSSMin-v1.1.2.php');
require_once(wire('config')->paths->AllInOneMinify.'lib'.DIRECTORY_SEPARATOR.'cssmin.php');

// ------------------------------------------------------------------------
// Load the URL Rewriting Library
Expand Down Expand Up @@ -595,7 +594,7 @@ class AllInOneMinify extends WireData implements Module, ConfigurableModule {
// Load source of file and rewrite absolute URLs.
// ------------------------------------------------------------------------
$_css_src = file_get_contents($stylesheet['absolute_path']).PHP_EOL;
$_css_src = (!empty($_css_src)) ? Minify_CSS_UriRewriter::rewrite($_css_src, dirname($stylesheet['absolute_path']),wire('config')->paths->root) : $_css_src;
$_css_src = (!empty($_css_src)) ? Minify_CSS_UriRewriter::rewrite($_css_src, dirname($stylesheet['absolute_path'])) : $_css_src;

// ------------------------------------------------------------------------
// If LESS file then run LESS parser.
Expand All @@ -614,7 +613,8 @@ class AllInOneMinify extends WireData implements Module, ConfigurableModule {
// ------------------------------------------------------------------------
// Minimize generated css
// ------------------------------------------------------------------------
$_css_src = (!empty($_css_src) AND self::$developmentMode !== true AND !self::_isMinimized($stylesheet['absolute_path'])) ? CssMin::minify($_css_src) : $_css_src;
$cssMin = new CSSmin();
$_css_src = (!empty($_css_src) AND self::$developmentMode !== true AND !self::_isMinimized($stylesheet['absolute_path'])) ? $cssMin->run($_css_src) : $_css_src;
$_css .= $_css_src;
}

Expand Down
Loading

0 comments on commit 5932081

Please sign in to comment.