summaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
authorBenjamin Franzke <benjaminfranzke@googlemail.com>2016-07-05 10:44:34 +0200
committerBenjamin Franzke <benjaminfranzke@googlemail.com>2016-07-05 11:10:01 +0200
commitbd21ec5e5bd69ee3bf3a4aeea7a72297990651e3 (patch)
treed5e6f688f57e35db1fdbb70d0873ad9e52632848 /Makefile
parent20ed35a28c6e479f4b2b2acc358bde32dc495631 (diff)
downloadmutti-web-bd21ec5e5bd69ee3bf3a4aeea7a72297990651e3.tar.gz
mutti-web-bd21ec5e5bd69ee3bf3a4aeea7a72297990651e3.tar.bz2
mutti-web-bd21ec5e5bd69ee3bf3a4aeea7a72297990651e3.zip
Minify html
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile12
1 files changed, 9 insertions, 3 deletions
diff --git a/Makefile b/Makefile
index ff356b5..f7f4008 100644
--- a/Makefile
+++ b/Makefile
@@ -5,6 +5,9 @@ version = $(shell git rev-parse --short HEAD)
versioned_jpg = 's/.*/.jpg?&/'
versioned_png = 's/.*/.png?&/'
+#versioned_jpg='s/.*/.&.jpg/'
+#versioned_png='s/.*/.&.png/'
+
version_args = --stringparam versioned_jpg $(shell echo $(version) | sed $(versioned_jpg)) --stringparam versioned_png $(shell echo $(version) | sed $(versioned_png))
xsltproc=xsltproc --stringparam stylesheet "$(shell cat style/style.min.css)" --stringparam version $(version) $(version_args)
@@ -13,12 +16,15 @@ fix_doctype=sed 's/ SYSTEM "about:legacy-compat"//'
to_html=$(fix_doctype) | xsltproc xsl/convert-xhtml-to-html.xsl - | $(fix_doctype) | sed -e 's/<br><\/br>/<br>/g' -e 's/<\/img>//g' -e 's/<\/link>//g' -e 's/<\/meta>//g' -e 's/<html xmlns="http:\/\/www.w3.org\/1999\/xhtml"/<html/'
+#html_minify=./node_modules/.bin/html-minifier --html5 --remove-optional-tags --use-short-doctype --remove-attribute-quotes
+html_minify=sed -f minify_html.sed
+
pages=$(shell xsltproc xsl/main_filenames.xsl main.xml)
pages_gen=$(pages:%.xml=%$(suffix))
pages_gen_html=$(pages:%.xml=%.html)
-common_depend=main.xml $(wildcard xsl/*.xsl) Makefile checkmark.svg style/style.min.css
+common_depend=main.xml $(wildcard xsl/*.xsl) Makefile checkmark.svg style/style.min.css minify_html.sed
DEFAULT_VERBOSITY=0
@@ -51,10 +57,10 @@ html: $(pages_gen_html)
$(V_XSLT) $(xsltproc) --stringparam suffix $(link_suffix) $< | $(fix_doctype) > $@
%.html: %.xml %.xsl $(common_depend)
- $(V_XSLT) $(xsltproc) --stringparam suffix .html $< | $(to_html) > $@
+ $(V_XSLT) $(xsltproc) --stringparam suffix .html $< | $(to_html) | $(html_minify) > $@
%.html: %.xml $(common_depend)
- $(V_XSLT) $(xsltproc) --stringparam suffix .html $< | $(to_html) > $@
+ $(V_XSLT) $(xsltproc) --stringparam suffix .html $< | $(to_html) | $(html_minify) > $@
style/style.min.css: style/style.css style/font.css
$(V_CSS) node_modules/.bin/postcss -u postcss-import -u postcss-css-variables style/style.css | node_modules/.bin/cleancss > style/style.min.css