From 5f253d16659b28d366a5060def3f0a6fd383eb4e Mon Sep 17 00:00:00 2001 From: Alexandre Duret-Lutz Date: Thu, 10 Sep 2020 11:22:24 +0200 Subject: [PATCH] minify SVG images if possible Fixes #422. * HACKING: mention svgo * doc/Makefile.am (dist-hook, stamp): Run svgo on produced SVGs. --- HACKING | 2 ++ doc/Makefile.am | 14 ++++++++++++-- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/HACKING b/HACKING index 12371ffe6..656d66e76 100644 --- a/HACKING +++ b/HACKING @@ -53,6 +53,8 @@ only for certain operations (like releases): pandoc used during Debian packaging for the conversion of IPython notebooks to html + svgo for reducing SVG images before generating the tarball + (install with: npm install -g svgo) ltl2ba used in the generated documentation and the test suite ltl2dstar likewise ltl3dra likewise diff --git a/doc/Makefile.am b/doc/Makefile.am index 1a295ed5d..8c59630b4 100644 --- a/doc/Makefile.am +++ b/doc/Makefile.am @@ -1,5 +1,5 @@ ## -*- coding: utf-8 -*- -## Copyright (C) 2010-2011, 2013-2019 Laboratoire de Recherche et +## Copyright (C) 2010-2011, 2013-2020 Laboratoire de Recherche et ## Développement de l'Epita (LRDE). ## Copyright (C) 2003-2005 Laboratoire d'Informatique de Paris 6 ## (LIP6), département Systèmes Répartis Coopératifs (SRC), Université @@ -29,15 +29,25 @@ endif all-local: $(DOXY_STAMP) $(srcdir)/org-stamp -.PHONY: doc +.PHONY: doc svgo doc: -rm -f stamp $(MAKE) stamp +# We use SVGO only if it is available. +SVGO = if ! (svgo -v >/dev/null); then :; else svgo --disable=removeViewBox +SVGOEND = ; fi + +dist-hook: svgo +svgo: + $(SVGO) -f $(distdir)/userdoc $(SVGOEND) + + stamp: $(srcdir)/Doxyfile.in $(top_srcdir)/configure.ac $(MAKE) Doxyfile -rm -rf spot.html spot.latex $(DOXYGEN) + $(SVGO) -f spot.html $(SVGOEND) touch $@ spot.html spot.tag: stamp