Author: ralfbecker
New Revision: 55950
URL: http://svn.stylite.de/viewvc/egroupware?rev=55950&view=rev
Log:
use Grunt&cssmin to minify CSS files, moved diverse conditional includes into etemplate2.css, as we anyway include all widgets from api
Modified:
trunk/egroupware/Gruntfile.js
trunk/egroupware/api/js/egw_action/egw_menu_dhtmlx.js
trunk/egroupware/api/js/etemplate/et2_widget_color.js
trunk/egroupware/api/js/etemplate/et2_widget_diff.js
trunk/egroupware/api/js/etemplate/et2_widget_taglist.js
trunk/egroupware/api/src/Etemplate.php
trunk/egroupware/api/src/Framework.php
trunk/egroupware/api/src/Framework/CssIncludes.php
trunk/egroupware/api/templates/default/etemplate2.css
trunk/egroupware/package.json
trunk/egroupware/updateGruntfile.php
— trunk/egroupware/Gruntfile.js (original)
+++ trunk/egroupware/Gruntfile.js Sat Apr 30 11:29:54 2016
@@ -15,12 +15,15 @@
-
npm install grunt --save-dev
-
npm install grunt-contrib-uglify --save-dev
-
npm install grunt-newer --save-dev
-
-
grunt # runs uglify and cssmin for all targets with changed files
- or
-
grunt [newer:]uglify:<target> # targets: api, et2, pixelegg, mobile, mail, calendar, ...
-
-
-
},
-
cssmin: {
-
options: {
-
shorthandCompacting: false,
-
sourceMap: true,
-
relativeTo: "pixelegg\/css\/"
-
},
-
pixelegg: {
-
files: {
-
"pixelegg\/css\/pixelegg.min.css": [
-
"api\/js\/jquery\/chosen\/chosen.css",
-
"api\/js\/jquery\/jquery-ui\/redmond\/jquery-ui.css",
-
"api\/js\/jquery\/magicsuggest\/magicsuggest.css",
-
"api\/js\/jquery\/jpicker\/css\/jPicker-1.1.6.min.css",
-
"api\/js\/jquery\/jquery-ui-timepicker-addon.css",
-
"api\/js\/jquery\/blueimp\/css\/blueimp-gallery.min.css",
-
"api\/js\/dhtmlxtree\/codebase\/dhtmlXTree.css",
-
"api\/js\/egw_action\/test\/skins\/dhtmlxmenu_egw.css",
-
"api\/js\/etemplate\/lib\/jsdifflib\/diffview.css",
-
"api\/templates\/default\/etemplate2.css",
-
"pixelegg\/css\/pixelegg.css",
-
"phpgwapi\/templates\/idots\/print.css",
-
"jdots\/print.css",
-
"pixelegg\/print.css"
-
],
-
"pixelegg\/css\/mobile.min.css": [
-
"api\/js\/jquery\/chosen\/chosen.css",
-
"api\/js\/jquery\/jquery-ui\/redmond\/jquery-ui.css",
-
"api\/js\/jquery\/magicsuggest\/magicsuggest.css",
-
"api\/js\/jquery\/jpicker\/css\/jPicker-1.1.6.min.css",
-
"api\/js\/jquery\/jquery-ui-timepicker-addon.css",
-
"api\/js\/jquery\/blueimp\/css\/blueimp-gallery.min.css",
-
"api\/js\/dhtmlxtree\/codebase\/dhtmlXTree.css",
-
"api\/js\/egw_action\/test\/skins\/dhtmlxmenu_egw.css",
-
"api\/js\/etemplate\/lib\/jsdifflib\/diffview.css",
-
"api\/templates\/default\/etemplate2.css",
-
"pixelegg\/css\/mobile.css",
-
"phpgwapi\/templates\/idots\/print.css",
-
"jdots\/print.css",
-
"pixelegg\/print.css"
-
],
-
"pixelegg\/mobile\/fw_mobile.min.css": [
-
"api\/js\/jquery\/chosen\/chosen.css",
-
"api\/js\/jquery\/jquery-ui\/redmond\/jquery-ui.css",
-
"api\/js\/jquery\/magicsuggest\/magicsuggest.css",
-
"api\/js\/jquery\/jpicker\/css\/jPicker-1.1.6.min.css",
-
"api\/js\/jquery\/jquery-ui-timepicker-addon.css",
-
"api\/js\/jquery\/blueimp\/css\/blueimp-gallery.min.css",
-
"api\/js\/dhtmlxtree\/codebase\/dhtmlXTree.css",
-
"api\/js\/egw_action\/test\/skins\/dhtmlxmenu_egw.css",
-
"api\/js\/etemplate\/lib\/jsdifflib\/diffview.css",
-
"api\/templates\/default\/etemplate2.css",
-
"pixelegg\/mobile\/fw_mobile.css",
-
"phpgwapi\/templates\/idots\/print.css",
-
"jdots\/print.css",
-
"pixelegg\/print.css"
-
]
-
}
-
},
-
jdots: {
-
files: {
-
"jdots\/css\/high-contrast.min.css": [
-
"api\/js\/jquery\/chosen\/chosen.css",
-
"api\/js\/jquery\/jquery-ui\/redmond\/jquery-ui.css",
-
"api\/js\/jquery\/magicsuggest\/magicsuggest.css",
-
"api\/js\/jquery\/jpicker\/css\/jPicker-1.1.6.min.css",
-
"api\/js\/jquery\/jquery-ui-timepicker-addon.css",
-
"api\/js\/jquery\/blueimp\/css\/blueimp-gallery.min.css",
-
"api\/js\/dhtmlxtree\/codebase\/dhtmlXTree.css",
-
"api\/js\/egw_action\/test\/skins\/dhtmlxmenu_egw.css",
-
"api\/js\/etemplate\/lib\/jsdifflib\/diffview.css",
-
"api\/templates\/default\/etemplate2.css",
-
"phpgwapi\/templates\/default\/def_tutorials.css",
-
"phpgwapi\/templates\/idots\/css\/traditional.css",
-
"jdots\/egw_fw.css",
-
"jdots\/css\/jdots.css",
-
"jdots\/css\/high-contrast.css",
-
"phpgwapi\/templates\/idots\/print.css",
-
"jdots\/print.css"
-
],
-
"jdots\/css\/jdots.min.css": [
-
"api\/js\/jquery\/chosen\/chosen.css",
-
"api\/js\/jquery\/jquery-ui\/redmond\/jquery-ui.css",
-
"api\/js\/jquery\/magicsuggest\/magicsuggest.css",
-
"api\/js\/jquery\/jpicker\/css\/jPicker-1.1.6.min.css",
-
"api\/js\/jquery\/jquery-ui-timepicker-addon.css",
-
"api\/js\/jquery\/blueimp\/css\/blueimp-gallery.min.css",
-
"api\/js\/dhtmlxtree\/codebase\/dhtmlXTree.css",
-
"api\/js\/egw_action\/test\/skins\/dhtmlxmenu_egw.css",
-
"api\/js\/etemplate\/lib\/jsdifflib\/diffview.css",
-
"api\/templates\/default\/etemplate2.css",
-
"phpgwapi\/templates\/default\/def_tutorials.css",
-
"phpgwapi\/templates\/idots\/css\/traditional.css",
-
"jdots\/egw_fw.css",
-
"jdots\/css\/jdots.css",
-
"phpgwapi\/templates\/idots\/print.css",
-
"jdots\/print.css"
-
],
-
"jdots\/css\/orange-green.min.css": [
-
"api\/js\/jquery\/chosen\/chosen.css",
-
"api\/js\/jquery\/jquery-ui\/redmond\/jquery-ui.css",
-
"api\/js\/jquery\/magicsuggest\/magicsuggest.css",
-
"api\/js\/jquery\/jpicker\/css\/jPicker-1.1.6.min.css",
-
"api\/js\/jquery\/jquery-ui-timepicker-addon.css",
-
"api\/js\/jquery\/blueimp\/css\/blueimp-gallery.min.css",
-
"api\/js\/dhtmlxtree\/codebase\/dhtmlXTree.css",
-
"api\/js\/egw_action\/test\/skins\/dhtmlxmenu_egw.css",
-
"api\/js\/etemplate\/lib\/jsdifflib\/diffview.css",
-
"api\/templates\/default\/etemplate2.css",
-
"phpgwapi\/templates\/default\/def_tutorials.css",
-
"phpgwapi\/templates\/idots\/css\/traditional.css",
-
"jdots\/egw_fw.css",
-
"jdots\/css\/jdots.css",
-
"jdots\/css\/orange-green.css",
-
"phpgwapi\/templates\/idots\/print.css",
-
"jdots\/print.css"
-
]
-
}
-
}
}
});
// Load the plugin that provides the “uglify” task.
grunt.loadNpmTasks(‘grunt-contrib-uglify’);
-
// Load plugin for css minificaton
-
grunt.loadNpmTasks(‘grunt-contrib-cssmin’);
-
// Load the plugin that runs tasks only on modified files
grunt.loadNpmTasks(‘grunt-newer’);
// Default task(s).
- grunt.registerTask(‘default’, [‘newer:uglify’]);
- grunt.registerTask(‘default’, [‘newer:uglify’, ‘newer:cssmin’]);
};
— trunk/egroupware/api/js/egw_action/egw_menu_dhtmlx.js (original)
+++ trunk/egroupware/api/js/egw_action/egw_menu_dhtmlx.js Sat Apr 30 11:29:54 2016
@@ -17,7 +17,12 @@
*/
// Need CSS, or it doesn’t really work
-if(typeof egw == ‘function’) egw(window).includeCSS(egw.webserverUrl + “/api/js/egw_action/test/skins/dhtmlxmenu_egw.css”);
+//if(typeof egw == ‘function’) egw(window).includeCSS(egw.webserverUrl + “/api/js/egw_action/test/skins/dhtmlxmenu_egw.css”);
+
+/**
egwMenuImpl.prototype.showAt = function(_x, _y, _onHide)
@@ -182,11 +187,9 @@
self.dhtmlxmenu.showContextMenu(_x, _y);
// TODO: Get keybard focus
}, 0);
-}
+};
egwMenuImpl.prototype.hide = function()
{
this.dhtmlxmenu.hide();
-}
+};
— trunk/egroupware/api/js/etemplate/et2_widget_color.js (original)
+++ trunk/egroupware/api/js/etemplate/et2_widget_color.js Sat Apr 30 11:29:54 2016
@@ -56,7 +56,8 @@
init: function() {
this._super.apply(this, arguments);
— trunk/egroupware/api/js/etemplate/et2_widget_diff.js (original)
+++ trunk/egroupware/api/js/etemplate/et2_widget_diff.js Sat Apr 30 11:29:54 2016
@@ -40,7 +40,8 @@
this._super.apply(this, arguments);
this.mini = true;
-
// included via etemplate2.css
-
//this.egw().includeCSS('etemplate/js/lib/jsdifflib/diffview.css');
this.div = document.createElement("div");
jQuery(this.div).addClass('diff');
},
@@ -106,6 +107,8 @@
/**
- Make the diff into a mini-diff
-
-
-
@param {DOMNode|String} view
*/
minify: function(view) {
view = jQuery(view)
@@ -118,6 +121,11 @@
.prevAll().hide();
},
-
/**
-
-
-
-
@param {DOMNode|String} view
-
*/
un_minify: function(view) {
jQuery(view).removeClass(‘mini’).show();
jQuery(‘th’,view).show();
@@ -133,6 +141,8 @@
* Build a list of attributes which can be set when working in the
* “detached” mode in the _attrs array which is provided
* by the calling code.
-
*
-
* @param {object} _attrs
*/
getDetachedAttributes: function(_attrs) {
_attrs.push("value", "label");
— trunk/egroupware/api/js/etemplate/et2_widget_taglist.js (original)
+++ trunk/egroupware/api/js/etemplate/et2_widget_taglist.js Sat Apr 30 11:29:54 2016
@@ -358,7 +358,7 @@
$j('.ms-trigger',this.div).on('click', function(e) {
e.stopPropagation();
@@ -458,7 +458,7 @@
this._query_server = false;
// Turn on local filtering, or trust server to do it
// Require css
-// TODO: merge into etemplate2.css with all other widgets when done
-if(typeof egw == ‘function’) egw(window).includeCSS(egw.webserverUrl + “/api/js/jquery/magicsuggest/magicsuggest.css”);
+// included via etemplate2.css
+//if(typeof egw == ‘function’) egw(window).includeCSS(egw.webserverUrl + “/api/js/jquery/magicsuggest/magicsuggest.css”);
— trunk/egroupware/api/src/Etemplate.php (original)
+++ trunk/egroupware/api/src/Etemplate.php Sat Apr 30 11:29:54 2016
@@ -211,15 +211,6 @@
}
else // first call
{
-
// missing dependency, thought egw:uses jquery.jquery.tools does NOT work, maybe we should rename it to jquery-tools
-
// Framework::includeJS('jquery','jquery.tools.min');
-
-
// Include the jQuery-UI CSS - many more complex widgets use it
-
$theme = 'redmond';
-
Framework::includeCSS("/api/js/jquery/jquery-ui/$theme/jquery-ui-1.10.3.custom.css");
-
// Load our CSS after jQuery-UI, so we can override it
-
Framework::includeCSS('/api/templates/default/etemplate2.css');
-
// check if application of template has a app.js file --> load it
list($app) = explode('.',$this->name);
if (file_exists(EGW_SERVER_ROOT.'/'.$app.'/js/app.js'))
— trunk/egroupware/api/src/Framework.php (original)
+++ trunk/egroupware/api/src/Framework.php Sat Apr 30 11:29:54 2016
@@ -814,43 +814,54 @@
if (self::$load_default_css)
{
-
// Load these first
-
// Cascade should go:
-
// Libs < etemplate2 < framework/theme < app < print
-
// Enhanced selectboxes (et1)
-
self::includeCSS('/api/js/jquery/chosen/chosen.css');
-
-
// eTemplate2 uses jQueryUI, so load it first so et2 can override if needed
-
self::includeCSS("/api/js/jquery/jquery-ui/redmond/jquery-ui.css");
-
-
// eTemplate2 - load in top so sidebox has styles too
-
self::includeCSS('/api/templates/default/etemplate2.css');
-
-
// Category styles
-
Categories::css(Categories::GLOBAL_APPNAME);
-
// For mobile user-agent we prefer mobile theme over selected one with a final fallback to theme named as template
$themes_to_check = array();
-
if (Header\UserAgent::mobile()) $themes_to_check[] = $this->template_dir.'/mobile/fw_mobile.css';
-
if (Header\UserAgent::mobile() || $GLOBALS['egw_info']['user']['preferences']['common']['theme'] == 'fw_mobile')
-
{
-
$themes_to_check[] = $this->template_dir.'/mobile/fw_mobile.css';
-
}
$themes_to_check[] = $this->template_dir.'/css/'.$GLOBALS['egw_info']['user']['preferences']['common']['theme'].'.css';
$themes_to_check[] = $this->template_dir.'/css/'.$this->template.'.css';
foreach($themes_to_check as $theme_css)
{
if (file_exists(EGW_SERVER_ROOT.$theme_css)) break;
}
-
$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);
-
}
-
else
-
{
-
// Load these first
-
// Cascade should go:
-
// Libs < etemplate2 < framework/theme < app < print
-
// Enhanced selectboxes (et1)
-
self::includeCSS('/api/js/jquery/chosen/chosen.css');
-
-
// eTemplate2 uses jQueryUI, so load it first so et2 can override if needed
-
self::includeCSS("/api/js/jquery/jquery-ui/redmond/jquery-ui.css");
-
-
// eTemplate2 - load in top so sidebox has styles too
-
self::includeCSS('/api/templates/default/etemplate2.css');
-
-
// Category styles
-
Categories::css(Categories::GLOBAL_APPNAME);
-
-
self::includeCSS($theme_css);
-
-
// sending print css last, so it can overwrite anything
-
$print_css = $this->template_dir.'/print.css';
-
if(!file_exists(EGW_SERVER_ROOT.$print_css))
-
{
-
$print_css = '/phpgwapi/templates/idots/print.css';
-
}
-
self::includeCSS($print_css);
-
}
// search for app specific css file, so it can customize the theme
self::includeCSS($GLOBALS['egw_info']['flags']['currentapp'], 'app-'.$GLOBALS['egw_info']['user']['preferences']['common']['theme']) ||
self::includeCSS($GLOBALS['egw_info']['flags']['currentapp'], 'app');
-
-
// sending print css last, so it can overwrite anything
-
$print_css = $this->template_dir.'/print.css';
-
if(!file_exists(EGW_SERVER_ROOT.$print_css))
-
{
-
$print_css = '/phpgwapi/templates/idots/print.css';
-
}
-
self::includeCSS($print_css);
}
return array(
'app_css' => $app_css,
@@ -950,7 +961,7 @@
function list_themes()
{
$list = array();
@@ -1293,6 +1304,7 @@
{
self::$load_default_css = false;
}
-
error_log(__METHOD__."('$app', '$name', append=$append, no_default=$no_default_css) ".function_backtrace());
return Framework\CssIncludes::add($app, $name, $append, $no_default_css);
}
@@ -1310,6 +1322,7 @@
// add all css files from Framework::includeCSS()
$query = null;
+error_log(METHOD."() Framework\CssIncludes::get()=".array2string(Framework\CssIncludes::get()));
foreach(Framework\CssIncludes::get() as $path)
{
unset($query);
— trunk/egroupware/api/src/Framework/CssIncludes.php (original)
+++ trunk/egroupware/api/src/Framework/CssIncludes.php Sat Apr 30 11:29:54 2016
@@ -79,9 +79,21 @@
*
* @return string
*/
- public static function get()
- public static function get($resolve=false)
{
-
if (!$resolve)
-
{
-
return self::$files;
-
}
-
$files = array();
-
foreach(self::$files as $path)
-
{
-
foreach(self::resolve_css_includes($path) as $path)
-
{
-
$files[] = $path;
-
}
-
}
-
return $files;
}
/**
@@ -93,7 +105,7 @@
{
// add all css files from self::includeCSS
$max_modified = 0;
@@ -109,12 +121,14 @@
{
$css_files .= ‘’."\n";
}
@@ -123,7 +137,7 @@
($GLOBALS[‘egw_info’][‘server’][‘debug_minify’] === ‘debug’ ? ‘&debug’ : ‘’).
’&’.$max_modified;
$css_files = ‘’."\n".$css_files;
— trunk/egroupware/api/templates/default/etemplate2.css (original)
+++ trunk/egroupware/api/templates/default/etemplate2.css Sat Apr 30 11:29:54 2016
@@ -13,6 +13,7 @@
/@import url("…/…/js/jquery/blueimp/css/blueimp-gallery.min.css");/
/@import url("…/…/js/dhtmlxtree/codebase/dhtmlXTree.css");/
/@import url("…/…/js/egw_action/test/skins/dhtmlxmenu_egw.css");/
+/@import url("…/…/js/etemplate/lib/jsdifflib/diffview.css");/
/**
— trunk/egroupware/package.json (original)
+++ trunk/egroupware/package.json Sat Apr 30 11:29:54 2016
@@ -7,6 +7,7 @@
“repository”: {},
“devDependencies”: {
“grunt”: “^0.4.5”,
- “grunt-contrib-cssmin”: “^1.0.1”,
“grunt-contrib-uglify”: “^0.11.1”,
“grunt-newer”: “^1.1.2”
}
— trunk/egroupware/updateGruntfile.php (original)
+++ trunk/egroupware/updateGruntfile.php Sat Apr 30 11:29:54 2016
@@ -10,6 +10,7 @@
+use EGroupware\Api\Framework;
use EGroupware\Api\Framework\Bundle;
if (php_sapi_name() !== ‘cli’) die(“This is a commandline ONLY tool!\n”);
@@ -77,6 +78,39 @@
}
}
+// add css for all templates and themes
+$cssmin =& $config[‘cssmin’];
+$GLOBALS[‘egw_info’][‘flags’][‘currentapp’] = ‘grunt’; // to no find any app.css files
+$GLOBALS[‘egw_info’][‘server’][‘debug_minify’] = ‘True’; // otherwise we would only get minified file
+foreach(array(‘pixelegg’,‘jdots’)/array_keys(Framework::list_templates())/ as $template)
+{
- $GLOBALS[‘egw_info’][‘server’][‘template_set’] = $template;
- $tpl = Framework::factory();
- $themes = $tpl->list_themes();
- if ($template == ‘pixelegg’) $themes[] = ‘fw_mobile’; // this is for mobile devices
- foreach($themes as $theme)
- {
-
// skip not working cssmin of pixelegg/traditional: Broken @import declaration of "../../etemplate/templates/default/etemplate2.css"
-
if ($template == 'pixelegg' && $theme == 'traditional') continue;
-
$GLOBALS['egw_info']['user']['preferences']['common']['theme'] = $theme;
-
// empty include list by not-existing file plus last true
-
Framework\CssIncludes::add('*grunt*', null, true, true);
-
$tpl->_get_css();
-
$dest = substr($tpl->template_dir, 1).($theme == 'fw_mobile' ? '/mobile/' : '/css/').$theme.'.min.css';
-
$cssmin[$template]['files'][$dest] =
-
// remove leading slash from src path
-
array_map(function($path)
-
{
-
return substr($path, 1);
-
},
-
// filter out all dynamic css, like categories.php
-
array_values(array_filter(Framework\CssIncludes::get(true), function($path)
-
{
-
return strpos($path, '.php?') === false;
-
})));
- }
+}
-
$new_json = str_replace("\n", “\n\t”,
preg_replace_callback(’/^( *)/m’, function($matches)
{
Find and fix application performance issues faster with Applications Manager
Applications Manager provides deep performance insights into multiple tiers of
your business applications. It resolves application problems quickly and
reduces your MTTR. Get your free trial!
https://ad.doubleclick.net/ddm/clk/302982198;130105516;z
eGroupWare-cvs mailing list
eGroupWare-cvs@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/egroupware-cvs