Better Primeview esm path

This commit is contained in:
cgfhtw
2023-10-24 15:04:45 +02:00
parent 645972d549
commit bae7096ca1
2 changed files with 6 additions and 12 deletions
-3
View File
@@ -63,9 +63,6 @@ $route['api/v1/system/[S|s]prache/(:any)'] = 'api/v1/system/sprache2/$1';
$route['studentenverwaltung/(:any)/(:any)'] = 'Studentenverwaltung/index';
$route['public/js/components/primevue/(:any)/(:any)'] = 'public/Primevue/index/$1/$2';
$route['public/js/components/primevue/(:any)/(:any)/(:any)'] = 'public/Primevue/index/$2/$3/$1';
// load routes from extensions
$subdir = 'application/config/extensions';
$dirlist = scandir($subdir);
@@ -2,24 +2,21 @@
if (! defined('BASEPATH')) exit('No direct script access allowed');
class Primevue extends FHC_Controller
class Components extends FHC_Controller
{
/**
* @return void
*/
public function index($path, $file, $extrapath = null)
public function primevue(...$args)
{
if ($extrapath)
$path = $extrapath . '/' . $path;
$target = FHCPATH . 'vendor/npm-asset/primevue/' . $path . '/' . $file;
$path = implode('/', $args);
$target = FHCPATH . 'vendor/npm-asset/primevue/' . $path;
if (!file_exists($target))
return show_404();
$newUrl = '../../';
if ($extrapath)
$newUrl .= '../';
$newUrl = str_repeat('../', count($args));
$ext = substr($file, -7) == '.min.js' ? '.esm.min.js' : '.esm.js';
$ext = substr($path, -7) == '.min.js' ? '.esm.min.js' : '.esm.js';
$contents = file_get_contents($target);