Skip to content

Commit 09b89d1

Browse files
ferrous26gitster
authored andcommitted
instaweb: add minification awareness
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent bb4bbf7 commit 09b89d1

File tree

2 files changed

+14
-4
lines changed

2 files changed

+14
-4
lines changed

Makefile

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1561,9 +1561,15 @@ gitweb:
15611561

15621562
ifdef JSMIN
15631563
GITWEB_PROGRAMS += gitweb/gitweb.min.js
1564+
GITWEB_JS = gitweb/gitweb.min.js
1565+
else
1566+
GITWEB_JS = gitweb/gitweb.js
15641567
endif
15651568
ifdef CSSMIN
15661569
GITWEB_PROGRAMS += gitweb/gitweb.min.css
1570+
GITWEB_CSS = gitweb/gitweb.min.css
1571+
else
1572+
GITWEB_CSS = gitweb/gitweb.css
15671573
endif
15681574
OTHER_PROGRAMS += gitweb/gitweb.cgi $(GITWEB_PROGRAMS)
15691575
gitweb/gitweb.cgi: gitweb/gitweb.perl $(GITWEB_PROGRAMS)
@@ -1586,11 +1592,13 @@ git-instaweb: git-instaweb.sh gitweb/gitweb.cgi gitweb/gitweb.css gitweb/gitweb.
15861592
-e 's/@@NO_CURL@@/$(NO_CURL)/g' \
15871593
-e '/@@GITWEB_CGI@@/r gitweb/gitweb.cgi' \
15881594
-e '/@@GITWEB_CGI@@/d' \
1589-
-e '/@@GITWEB_CSS@@/r gitweb/gitweb.css' \
1595+
-e '/@@GITWEB_CSS@@/r $(GITWEB_CSS)' \
15901596
-e '/@@GITWEB_CSS@@/d' \
1591-
-e '/@@GITWEB_JS@@/r gitweb/gitweb.js' \
1597+
-e '/@@GITWEB_JS@@/r $(GITWEB_JS)' \
15921598
-e '/@@GITWEB_JS@@/d' \
15931599
-e 's|@@PERL@@|$(PERL_PATH_SQ)|g' \
1600+
-e 's|@@GITWEB_CSS_NAME@@|$(GITWEB_CSS)|' \
1601+
-e 's|@@GITWEB_JS_NAME@@|$(GITWEB_JS)|' \
15941602
[email protected] > $@+ && \
15951603
chmod +x $@+ && \
15961604
mv $@+ $@

git-instaweb.sh

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -391,18 +391,20 @@ EOFGITWEB
391391
gitweb_css () {
392392
cat > "$1" <<\EOFGITWEB
393393
@@GITWEB_CSS@@
394+
394395
EOFGITWEB
395396
}
396397

397398
gitweb_js () {
398399
cat > "$1" <<\EOFGITWEB
399400
@@GITWEB_JS@@
401+
400402
EOFGITWEB
401403
}
402404

403405
gitweb_cgi "$GIT_DIR/gitweb/gitweb.cgi"
404-
gitweb_css "$GIT_DIR/gitweb/gitweb.css"
405-
gitweb_js "$GIT_DIR/gitweb/gitweb.js"
406+
gitweb_css "$GIT_DIR/@@GITWEB_CSS_NAME@@"
407+
gitweb_js "$GIT_DIR/@@GITWEB_JS_NAME@@"
406408

407409
case "$httpd" in
408410
*lighttpd*)

0 commit comments

Comments
 (0)