{"thread":{"id":"23314","subject":"[PATCHv6 2/6] Gitweb: add support for minifying gitweb.css","startedAt":"2010-04-03T00:35:05Z","lastAt":"2010-04-03T00:35:05Z","messageCount":1,"participants":["Mark Rada"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"138481","messageId":"4BB68D39.9040103@mailservices.uwaterloo.ca","threadId":"23314","inReplyTo":null,"subject":"[PATCHv6 2/6] Gitweb: add support for minifying gitweb.css","fromName":"Mark Rada","fromEmail":"marada@uwaterloo.ca","sentAt":"2010-04-03T00:35:05Z","receivedAt":"2010-04-03T00:35:05Z","isPatch":false,"sender":{"key":"marada@uwaterloo.ca","avatar":"https://avatars.githubusercontent.com/u/38430?v=4"},"body":"The build system added support minifying gitweb.js through a\nJavaScript minifier, but most minifiers come with support for\nminifying CSS files as well, so we should use it if we can.\n\nThis patch will add the same facilities to gitweb.css that\ngitweb.js has for minification. That does not mean that they\nwill use the same minifier though, as it is not safe to assume\nthat all JavaScript minifiers will also minify CSS files.\n\nThis patch also adds the GITWEB_PROGRAMS variable to the Makefile\nto keep a list of potential gitweb dependencies separate from\nOTHER_PROGRAMS when we need to know just the gitweb dependencies.\n\nThough the bandwidth savings will not be as dramatic as with\nthe JavaScript minifier, every byte saved is important.\n\nSigned-off-by: Mark Rada <marada@uwaterloo.ca>\n\n---\n\nChanges since last revision:\n\t- Updated commit message to include a mention about adding\n\t  the GITWEB_PROGRAMS variable and reworded some of the first\n\t  paragraph\n\n\n Makefile        |   21 +++++++++++++++------\n gitweb/INSTALL  |    5 +++++\n gitweb/Makefile |   28 +++++++++++++++++++++-------\n gitweb/README   |    3 ++-\n 4 files changed, 43 insertions(+), 14 deletions(-)\n\ndiff --git a/Makefile b/Makefile\nindex 0071e52..a48f42f 100644\n--- a/Makefile\n+++ b/Makefile\n@@ -203,6 +203,9 @@ all::\n # Define JSMIN to point to JavaScript minifier that functions as\n # a filter to have gitweb.js minified.\n #\n+# Define CSSMIN to point to a CSS minifier in order to generate a minified\n+# version of gitweb.css\n+#\n # Define DEFAULT_PAGER to a sensible pager command (defaults to \"less\") if\n # you want to use something different.  The value will be interpreted by the\n # shell at runtime when it is used.\n@@ -279,8 +282,9 @@ lib = lib\n # DESTDIR=\n pathsep = :\n \n-# JavaScript minifier invocation that can function as filter\n+# JavaScript/CSS minifier invocation that can function as filter\n JSMIN =\n+CSSMIN =\n \n export prefix bindir sharedir sysconfdir\n \n@@ -1566,18 +1570,23 @@ gitweb:\n \t$(QUIET_SUBDIR0)gitweb $(QUIET_SUBDIR1) all\n \n ifdef JSMIN\n-OTHER_PROGRAMS += gitweb/gitweb.cgi   gitweb/gitweb.min.js\n-gitweb/gitweb.cgi: gitweb/gitweb.perl gitweb/gitweb.min.js\n-else\n-OTHER_PROGRAMS += gitweb/gitweb.cgi\n-gitweb/gitweb.cgi: gitweb/gitweb.perl\n+GITWEB_PROGRAMS += gitweb/gitweb.min.js\n endif\n+ifdef CSSMIN\n+GITWEB_PROGRAMS += gitweb/gitweb.min.css\n+endif\n+OTHER_PROGRAMS +=  gitweb/gitweb.cgi  $(GITWEB_PROGRAMS)\n+gitweb/gitweb.cgi: gitweb/gitweb.perl $(GITWEB_PROGRAMS)\n \t$(QUIET_SUBDIR0)gitweb $(QUIET_SUBDIR1) $(patsubst gitweb/%,%,$@)\n \n ifdef JSMIN\n gitweb/gitweb.min.js: gitweb/gitweb.js\n \t$(QUIET_SUBDIR0)gitweb $(QUIET_SUBDIR1) $(patsubst gitweb/%,%,$@)\n endif # JSMIN\n+ifdef CSSMIN\n+gitweb/gitweb.min.css: gitweb/gitweb.css\n+\t$(QUIET_SUBDIR0)gitweb $(QUIET_SUBDIR1) $(patsubst gitweb/%,%,$@)\n+endif # CSSMIN\n \n \n git-instaweb: git-instaweb.sh gitweb/gitweb.cgi gitweb/gitweb.css gitweb/gitweb.js\ndiff --git a/gitweb/INSTALL b/gitweb/INSTALL\nindex b76a0cf..b75a90b 100644\n--- a/gitweb/INSTALL\n+++ b/gitweb/INSTALL\n@@ -66,6 +66,11 @@ file for gitweb (in gitweb/README).\n   build configuration variables. By default gitweb tries to find them\n   in the same directory as gitweb.cgi script.\n \n+- You can optionally generate a minified version of gitweb.css by defining\n+  the CSSMIN build configuration variable. By default the non-minified\n+  version of gitweb.css will be used. NOTE: if you enable this option,\n+  substitute gitweb.min.css for all uses of gitweb.css in the help files.\n+\n Build example\n ~~~~~~~~~~~~~\n \ndiff --git a/gitweb/Makefile b/gitweb/Makefile\nindex c9eb1ee..fffe700 100644\n--- a/gitweb/Makefile\n+++ b/gitweb/Makefile\n@@ -6,13 +6,17 @@ all::\n # Define JSMIN to point to JavaScript minifier that functions as\n # a filter to have gitweb.js minified.\n #\n+# Define CSSMIN to point to a CSS minifier in order to generate a minified\n+# version of gitweb.css\n+#\n \n prefix ?= $(HOME)\n bindir ?= $(prefix)/bin\n RM ?= rm -f\n \n-# JavaScript minifier invocation that can function as filter\n+# JavaScript/CSS minifier invocation that can function as filter\n JSMIN ?=\n+CSSMIN ?=\n \n # default configuration for gitweb\n GITWEB_CONFIG = gitweb_config.perl\n@@ -26,7 +30,11 @@ GITWEB_STRICT_EXPORT =\n GITWEB_BASE_URL =\n GITWEB_LIST =\n GITWEB_HOMETEXT = indextext.html\n+ifdef CSSMIN\n+GITWEB_CSS = gitweb.min.css\n+else\n GITWEB_CSS = gitweb.css\n+endif\n GITWEB_LOGO = git-logo.png\n GITWEB_FAVICON = git-favicon.png\n ifdef JSMIN\n@@ -84,13 +92,14 @@ endif\n \n all:: gitweb.cgi\n \n+FILES = gitweb.cgi\n ifdef JSMIN\n-FILES=gitweb.cgi gitweb.min.js\n-gitweb.cgi: gitweb.perl gitweb.min.js\n-else # !JSMIN\n-FILES=gitweb.cgi\n-gitweb.cgi: gitweb.perl\n-endif # JSMIN\n+FILES += gitweb.min.js\n+endif\n+ifdef CSSMIN\n+FILES += gitweb.min.css\n+endif\n+gitweb.cgi: gitweb.perl $(GITWEB_JS) $(GITWEB_CSS)\n \n gitweb.cgi:\n \t$(QUIET_GEN)$(RM) $@ $@+ && \\\n@@ -123,6 +132,11 @@ gitweb.min.js: gitweb.js\n \t$(QUIET_GEN)$(JSMIN) <$< >$@\n endif # JSMIN\n \n+ifdef CSSMIN\n+gitweb.min.css: gitweb.css\n+\t$(QUIET_GEN)$(CSSMIN) <$ >$@\n+endif\n+\n clean:\n \t$(RM) $(FILES)\n \ndiff --git a/gitweb/README b/gitweb/README\nindex ad6a04c..71742b3 100644\n--- a/gitweb/README\n+++ b/gitweb/README\n@@ -80,7 +80,8 @@ You can specify the following configuration variables when building GIT:\n    Points to the location where you put gitweb.css on your web server\n    (or to be more generic, the URI of gitweb stylesheet).  Relative to the\n    base URI of gitweb.  Note that you can setup multiple stylesheets from\n-   the gitweb config file.  [Default: gitweb.css]\n+   the gitweb config file.  [Default: gitweb.css (or gitweb.min.css if the\n+   CSSMIN variable is defined / CSS minifier is used)]\n  * GITWEB_LOGO\n    Points to the location where you put git-logo.png on your web server\n    (or to be more generic URI of logo, 72x27 size, displayed in top right\n-- \n1.7.0.3.519.g7e0613\n"}]}