Skip to content

Commit

Permalink
instaweb: add minification awareness
Browse files Browse the repository at this point in the history
This patch will cause git-instaweb to use the minified version of gitweb
support files (e.g. CSS and JavaScript) if they were generated.

Without minification awareness, generating the minified version of
gitweb's support files will generate a broken instaweb script since the
copy of gitweb.cgi will look for gitweb.min.* which will not exist.

Signed-off-by: Mark Rada <marada@uwaterloo.ca>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
  • Loading branch information
Mark Rada authored and Junio C Hamano committed Apr 3, 2010
1 parent bb4bbf7 commit 09b89d1
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 4 deletions.
12 changes: 10 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -1561,9 +1561,15 @@ gitweb:

ifdef JSMIN
GITWEB_PROGRAMS += gitweb/gitweb.min.js
GITWEB_JS = gitweb/gitweb.min.js
else
GITWEB_JS = gitweb/gitweb.js
endif
ifdef CSSMIN
GITWEB_PROGRAMS += gitweb/gitweb.min.css
GITWEB_CSS = gitweb/gitweb.min.css
else
GITWEB_CSS = gitweb/gitweb.css
endif
OTHER_PROGRAMS += gitweb/gitweb.cgi $(GITWEB_PROGRAMS)
gitweb/gitweb.cgi: gitweb/gitweb.perl $(GITWEB_PROGRAMS)
Expand All @@ -1586,11 +1592,13 @@ git-instaweb: git-instaweb.sh gitweb/gitweb.cgi gitweb/gitweb.css gitweb/gitweb.
-e 's/@@NO_CURL@@/$(NO_CURL)/g' \
-e '/@@GITWEB_CGI@@/r gitweb/gitweb.cgi' \
-e '/@@GITWEB_CGI@@/d' \
-e '/@@GITWEB_CSS@@/r gitweb/gitweb.css' \
-e '/@@GITWEB_CSS@@/r $(GITWEB_CSS)' \
-e '/@@GITWEB_CSS@@/d' \
-e '/@@GITWEB_JS@@/r gitweb/gitweb.js' \
-e '/@@GITWEB_JS@@/r $(GITWEB_JS)' \
-e '/@@GITWEB_JS@@/d' \
-e 's|@@PERL@@|$(PERL_PATH_SQ)|g' \
-e 's|@@GITWEB_CSS_NAME@@|$(GITWEB_CSS)|' \
-e 's|@@GITWEB_JS_NAME@@|$(GITWEB_JS)|' \
$@.sh > $@+ && \
chmod +x $@+ && \
mv $@+ $@
Expand Down
6 changes: 4 additions & 2 deletions git-instaweb.sh
Original file line number Diff line number Diff line change
Expand Up @@ -391,18 +391,20 @@ EOFGITWEB
gitweb_css () {
cat > "$1" <<\EOFGITWEB
@@GITWEB_CSS@@
EOFGITWEB
}

gitweb_js () {
cat > "$1" <<\EOFGITWEB
@@GITWEB_JS@@
EOFGITWEB
}

gitweb_cgi "$GIT_DIR/gitweb/gitweb.cgi"
gitweb_css "$GIT_DIR/gitweb/gitweb.css"
gitweb_js "$GIT_DIR/gitweb/gitweb.js"
gitweb_css "$GIT_DIR/@@GITWEB_CSS_NAME@@"
gitweb_js "$GIT_DIR/@@GITWEB_JS_NAME@@"

case "$httpd" in
*lighttpd*)
Expand Down

0 comments on commit 09b89d1

Please sign in to comment.