method getConfig documentation in bbn\Cdn\Library

Creates the configuration and returns it.

Example

// @var bbn\Cdn\Library $lib $lib->add('jquery-ui|latest|black'); $cfg = $lib->getConfig() X::dump($cfg); // { // "libraries": { // "jquery": "3.3.1", // "jquery-ui": "1.12.1", // }, // "prepend": [ // ], // "js": [ // "lib/jquery/3.3.1/dist/jquery.min.js", // "lib/jquery-ui/1.12.1/jquery-ui.min.js", // "lib/jquery-ui/1.12.1/i18n/datepicker-fr.js", // ], // "css": [ // "lib/jquery-ui/1.12.1/jquery-ui.min.css", // "lib/jquery-ui/1.12.1/jquery-ui.theme.min.css", // "lib/jquery-ui/1.12.1/themes/black/jquery-ui.min.css", // "lib/jquery-ui/1.12.1/themes/black/theme.css", // ], // } function() { $res = [ 'libraries' => [], 'prepend' => [], 'includes' => [] ]; foreach ($this->libs as $lib_name => $lib) { ksort($lib); $lib = current($lib); $res['libraries'][$lib_name] = (string)$lib['version']; if (isset($lib['prepend'])) { $res['prepend'] = array_merge($res['prepend'], $lib['prepend']); } $inc = $lib; foreach ($lib['files'] as $f) { $ext = bbn\Str::fileExt($f); foreach (self::$types as $type => $extensions) { if (in_array($ext, $extensions)) { if (!isset($res[$type])) { $res[$type] = []; $inc[$type] = []; } if (!in_array($f, $res[$type])) { $res[$type][] = $f; $inc[$type][] = substr($f, strlen($inc['path'])); } } } } unset($inc['files']); $res['includes'][] = $inc; } return $res; }

Creates the configuration and returns it. BBN is a suite of PHP and JS libraries and VueJS components - all open-source! bbn.io, build applications, the quick way

This website uses cookies to ensure you get the best experience on our website.