/** * Simple connection to the asset pipeline module. * returns/parses a url to the assets specified in array and option which will be handled by the * responsible pipe if the asset pipeline itself is loaded as a module during the request. * * Note: If the asset pipeline is inactive the call-routing can only handle a string! * * @param array|array $assets containing asset(s) as in ['jquery.js', 'myplugin.js'] (will be concatenated) * @param array $options for asset pipeline (path and other) defaults to ['min'] for asset minification in prod-mode and nulled path * * @return string the URI to the requested asset(s) */ public static function assets($assets, $options = []) { # Determines pipe by last file's extension, different files in one request is madness $pipe = pathinfo($assets[count($assets) - 1], PATHINFO_EXTENSION); $assets = implode("+", $assets); if (AssetPipeline::getConfig()['stage'] === 'prod') { $options[] = 'min'; } # Return the url with its options return LVC::get()->url('asset-pipeline::' . $pipe, array_merge($options, array($assets))); }