Same name in other branches
- 5.0.x src/Asset/SingleAssetOptimizerBase.php \Drupal\advagg\Asset\SingleAssetOptimizerBase::isMinified()
- 6.0.x src/Asset/SingleAssetOptimizerBase.php \Drupal\advagg\Asset\SingleAssetOptimizerBase::isMinified()
- 8.x-3.x src/Asset/SingleAssetOptimizerBase.php \Drupal\advagg\Asset\SingleAssetOptimizerBase::isMinified()
Check if the asset is already minified.
Parameters
string $contents: The asset contents.
Return value
bool TRUE if the asset appears to be already minified.
2 calls to SingleAssetOptimizerBase::isMinified()
- CssMinifier::optimize in advagg_css_minify/
src/ Asset/ CssMinifier.php - Optimize the asset's content.
- JsMinifier::optimize in advagg_js_minify/
src/ Asset/ JsMinifier.php - Optimize the asset's content.
File
-
src/
Asset/ SingleAssetOptimizerBase.php, line 95
Class
- SingleAssetOptimizerBase
- A base class for optimizing (especially minifying) assets.
Namespace
Drupal\advagg\AssetCode
protected function isMinified($contents) {
// If a lot of semicolons probably already minified.
$semicolon_count = substr_count($contents, ';');
if ($semicolon_count > 10 && $semicolon_count > substr_count($contents, "\n")) {
return TRUE;
}
return FALSE;
}