Files
php-flasher/bin/assets
T
2023-06-06 01:36:57 +01:00

41 lines
1.1 KiB
PHP
Executable File

#!/usr/bin/env php
<?php
require __DIR__ . '/../vendor/autoload.php';
/** @var \Flasher\Prime\Plugin\PluginInterface[] $plugins */
$plugins = array(
new \Flasher\Prime\Plugin\FlasherPlugin(),
new \Flasher\Noty\Prime\NotyPlugin(),
new \Flasher\Notyf\Prime\NotyfPlugin(),
new \Flasher\Pnotify\Prime\PnotifyPlugin(),
new \Flasher\SweetAlert\Prime\SweetAlertPlugin(),
new \Flasher\Toastr\Prime\ToastrPlugin(),
);
echo 'Downloading assets ...'. PHP_EOL;
foreach ($plugins as $plugin) {
$scripts = $plugin->getScripts();
foreach ($scripts['cdn'] as $index => $script) {
echo $script . PHP_EOL;
$path = $plugin->getAssetsDir() . '/'. pathinfo($script, PATHINFO_BASENAME);
$content = file_get_contents($script);
file_put_contents($path, $content);
}
$styles = $plugin->getStyles();
foreach ($styles['cdn'] as $index => $script) {
echo $script . PHP_EOL;
$path = $plugin->getAssetsDir() . '/'. pathinfo($script, PATHINFO_BASENAME);
$content = file_get_contents($script);
file_put_contents($path, $content);
}
}
echo 'DONE' . PHP_EOL;