function advagg_css_compress_yui_cssmin in Advanced CSS/JS Aggregation 7.2
Same name and namespace in other branches
- 6 advagg_css_compress/advagg_css_compress.module \advagg_css_compress_yui_cssmin()
Use the CSSmin library from YUI to compress the CSS.
4 calls to advagg_css_compress_yui_cssmin()
- advagg_css_compress_advagg_modify_css_pre_render_alter in advagg_css_compress/
advagg_css_compress.module - Implements hook_advagg_modify_css_pre_render_alter().
- hook_advagg_get_css_aggregate_contents_alter in ./
advagg.api.php - Allow other modules to modify this aggregates contents.
- hook_advagg_get_css_file_contents_alter in ./
advagg.api.php - Allow other modules to modify this files contents.
- hook_advagg_modify_css_pre_render_alter in ./
advagg.api.php - Allow other modules to modify $children and $elements before rendering.
1 string reference to 'advagg_css_compress_yui_cssmin'
- advagg_css_compress_configuration in advagg_css_compress/
advagg_css_compress.module - Generate the js compress configuration.
File
- advagg_css_compress/
advagg_css_compress.advagg.inc, line 75 - Advanced aggregation css compression module.
Code
function advagg_css_compress_yui_cssmin(&$data) {
// Try libraries for YUI.
if (is_callable('libraries_load')) {
libraries_load('YUI-CSS-compressor-PHP-port');
if (class_exists('tubalmartin\\CssMin\\Minifier')) {
// The "use" alias requires php 5.3.
// @codingStandardsIgnoreLine
$cssmin = new tubalmartin\CssMin\Minifier();
}
elseif (class_exists('CSSmin')) {
$cssmin = new CSSmin();
}
}
if (!isset($cssmin)) {
// Load CSSMin.inc if the CSSmin class variable is not set.
if (!class_exists('CSSmin')) {
include drupal_get_path('module', 'advagg_css_compress') . '/yui/CSSMin.inc';
}
$cssmin = new CSSmin();
}
if (!isset($cssmin)) {
return;
}
// Set line break to 4k of text.
if (method_exists($cssmin, 'setLineBreakPosition')) {
$cssmin
->setLineBreakPosition(4096);
}
// Compress the CSS splitting lines after 4k of text.
if (method_exists($cssmin, 'run')) {
$compressed = $cssmin
->run($data, 4096);
}
if (!empty($compressed)) {
$data = $compressed;
}
}