always generate minified CSS, if grunt is installed

- still run other npm tasks (install & build), if grunt is not installed
- run "npm install --legacy-peer-deps", to cope with dependency mismatch caused by downgraded grunt-newer
--> if developer install should not use minified CSS: remove grunt and the previous generated .min.css files
--> if downgraded grunt-newer caused CSS "problems": run once manually: grunt cssmin
This commit is contained in:
ralf 2022-04-21 13:45:38 +02:00
parent 84bc75f21e
commit f42f26d86b
3 changed files with 10 additions and 11 deletions

View File

@ -974,8 +974,9 @@ abstract class Framework extends Framework\Extra
{
if (file_exists(EGW_SERVER_ROOT.$theme_css)) break;
}
$debug_minify = !empty($GLOBALS['egw_info']['server']['debug_minify']) && $GLOBALS['egw_info']['server']['debug_minify'] === 'True';
if (!$debug_minify && file_exists(EGW_SERVER_ROOT.($theme_min_css = str_replace('.css', '.min.css', $theme_css))))
// no longer available in config, of you don't want minified CSS on a developer install, don't install grunt/generate the files
//$debug_minify = !empty($GLOBALS['egw_info']['server']['debug_minify']) && $GLOBALS['egw_info']['server']['debug_minify'] === 'True';
if (/*!$debug_minify &&*/ file_exists(EGW_SERVER_ROOT.($theme_min_css = str_replace('.css', '.min.css', $theme_css))))
{
//error_log(__METHOD__."() Framework\CssIncludes::get()=".array2string(Framework\CssIncludes::get()));
self::includeCSS($theme_min_css);
@ -1722,4 +1723,4 @@ abstract class Framework extends Framework\Extra
}
}
// Init all static variables
Framework::init_static();
Framework::init_static();

View File

@ -276,11 +276,11 @@ $cmd = $composer.' install '.implode(' ', $composer_args);
run_cmd($cmd, 'composer');
// update npm dependencies, run grunt to minify css and rollup to build javascript
if ($npm && $grunt)
if ($npm)
{
run_cmd($npm.' install', 'npm install');
run_cmd($npm.' install --legacy-peer-deps', 'npm install');
run_cmd($grunt, 'grunt');
if ($grunt) run_cmd($grunt, 'grunt');
run_cmd($npm .' run build', 'rollup (npm run build)');
}
@ -427,4 +427,4 @@ function github_api($_url, $data, $method='POST', $upload=null, $content_type=nu
curl_close($c);
return json_decode($response, true);
}
}

6
package-lock.json generated
View File

@ -8711,8 +8711,7 @@
"version": "0.5.4",
"resolved": "https://registry.npmjs.org/grunt-newer/-/grunt-newer-0.5.4.tgz",
"integrity": "sha1-HZDR3ynhVTRnbHPIXUR150VtNQo=",
"dev": true,
"requires": {}
"dev": true
},
"grunt-terser": {
"version": "1.0.0",
@ -10805,8 +10804,7 @@
"version": "7.5.3",
"resolved": "https://registry.npmjs.org/ws/-/ws-7.5.3.tgz",
"integrity": "sha512-kQ/dHIzuLrS6Je9+uv81ueZomEwH0qVYstcAQ4/Z93K8zeko9gtAbttJWzoC5ukqXY1PpoouV3+VSOqEAFt5wg==",
"dev": true,
"requires": {}
"dev": true
},
"yallist": {
"version": "4.0.0",