mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-12-22 14:41:29 +01:00
allow multiple uglify targets now: grunt [uglify:(api,et2,mail,calendar,...)]
This commit is contained in:
parent
4486d9d7a2
commit
337127243a
22
Gruntfile.js
22
Gruntfile.js
@ -18,6 +18,8 @@
|
||||
*
|
||||
* Building happens by running in your EGroupware directory:
|
||||
* grunt
|
||||
* or
|
||||
* grunt uglify:<target> # targets: api, et2, mail, calendar, ...
|
||||
*
|
||||
* app.js files can be added under apps target, api and et2 bundels are already there.
|
||||
* To update files in Gruntfile after adding new js files you need to run:
|
||||
@ -34,7 +36,7 @@ module.exports = function (grunt) {
|
||||
sourceMap: true,
|
||||
screwIE8: true
|
||||
},
|
||||
build: {
|
||||
api: {
|
||||
files: {
|
||||
"phpgwapi\/js\/jsapi.min.js": [
|
||||
"phpgwapi\/js\/jquery\/jquery.js",
|
||||
@ -84,7 +86,11 @@ module.exports = function (grunt) {
|
||||
"phpgwapi\/js\/jquery\/chosen\/chosen.jquery.js",
|
||||
"phpgwapi\/js\/ckeditor\/ckeditor.js",
|
||||
"phpgwapi\/js\/ckeditor\/config.js"
|
||||
],
|
||||
]
|
||||
}
|
||||
},
|
||||
et2: {
|
||||
files: {
|
||||
"etemplate\/js\/etemplate2.min.js": [
|
||||
"etemplate\/js\/et2_core_xml.js",
|
||||
"etemplate\/js\/et2_core_common.js",
|
||||
@ -177,8 +183,16 @@ module.exports = function (grunt) {
|
||||
"etemplate\/js\/et2_widget_script.js",
|
||||
"etemplate\/js\/et2_core_legacyJSFunctions.js",
|
||||
"etemplate\/js\/etemplate2.js"
|
||||
],
|
||||
"mail\/js\/app.min.js": "mail\/js\/app.js",
|
||||
]
|
||||
}
|
||||
},
|
||||
mail: {
|
||||
files: {
|
||||
"mail\/js\/app.min.js": "mail\/js\/app.js"
|
||||
}
|
||||
},
|
||||
calendar: {
|
||||
files: {
|
||||
"calendar\/js\/app.min.js": "calendar\/js\/app.js"
|
||||
}
|
||||
}
|
||||
|
@ -33,12 +33,7 @@ if (!preg_match('/grunt\.initConfig\(({.+})\);/s', $content, $matches) ||
|
||||
}
|
||||
//print_r($config); exit;
|
||||
|
||||
$bundle2min = array(
|
||||
'api' => 'phpgwapi/js/jsapi.min.js',
|
||||
'et2' => 'etemplate/js/etemplate2.min.js',
|
||||
);
|
||||
|
||||
$build_files =& $config['uglify']['build']['files'];
|
||||
$uglify =& $config['uglify'];
|
||||
|
||||
foreach(egw_framework::get_bundles() as $name => $files)
|
||||
{
|
||||
@ -51,13 +46,14 @@ foreach(egw_framework::get_bundles() as $name => $files)
|
||||
});
|
||||
|
||||
//var_dump($name, $files);
|
||||
if (isset($bundle2min[$name]))
|
||||
if (isset($uglify[$name]))
|
||||
{
|
||||
$build_files[$bundle2min[$name]] = array_values($files);
|
||||
list($target) = each($uglify[$name]['files']);
|
||||
$uglify[$name]['files'][$target] = array_values($files);
|
||||
}
|
||||
elseif (isset($bundle2min[$append = substr($name, 0, -1)]))
|
||||
elseif (isset($uglify[$append = substr($name, 0, -1)]))
|
||||
{
|
||||
$build_files[$bundle2min[$append]] = array_merge($build_files[$bundle2min[$append]], array_values($files));
|
||||
$uglify[$append]['files'][$target] = array_merge($uglify[$append]['files'][$target], array_values($files));
|
||||
}
|
||||
else
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user