[Libreoffice-commits] online.git: loleaflet/html loleaflet/Makefile.am

Jan Holesovsky (via logerrit) logerrit at kemper.freedesktop.org
Tue Mar 31 18:31:33 UTC 2020


 loleaflet/Makefile.am            |    1 -
 loleaflet/html/loleaflet.html.m4 |    9 ++++++++-
 2 files changed, 8 insertions(+), 2 deletions(-)

New commits:
commit 47d6d9eae6a80165912f0856e0bd28a6400e958f
Author:     Jan Holesovsky <kendy at collabora.com>
AuthorDate: Mon Mar 30 17:40:14 2020 +0200
Commit:     Jan Holesovsky <kendy at collabora.com>
CommitDate: Tue Mar 31 20:31:15 2020 +0200

    mobile detection: Load the bundle.css dynamically.
    
    So that the browser can cache the large css, instead of loading it anew
    each time we are loading loleaflet.html.
    
    Change-Id: I322bf9d62e4c899dbeffbca52aca83b6cd427ce4
    Reviewed-on: https://gerrit.libreoffice.org/c/online/+/91415
    Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice at gmail.com>
    Reviewed-by: Jan Holesovsky <kendy at collabora.com>

diff --git a/loleaflet/Makefile.am b/loleaflet/Makefile.am
index 3461fbe2f..e55196e06 100644
--- a/loleaflet/Makefile.am
+++ b/loleaflet/Makefile.am
@@ -407,7 +407,6 @@ $(builddir)/dist/loleaflet.html: $(srcdir)/html/loleaflet.html.m4 $(LOLEAFLET_HT
 		-DANDROIDAPP=$(ENABLE_ANDROIDAPP) \
 		-DMOBILEAPPNAME="$(APP_NAME)" \
 		-DLOLEAFLET_CSS="$(subst $(SPACE),$(COMMA),$(LOLEAFLET_CSS_M4))" \
-		-DBUNDLE_CSS="$(abs_builddir)/dist/bundle.css" \
 		-DGLOBAL_JS="$(abs_builddir)/dist/global.js" \
 		-DLOLEAFLET_JS="$(subst $(SPACE),$(COMMA),$(NODE_MODULES_JS) \
 		$(LOLEAFLET_LIBS_JS) \
diff --git a/loleaflet/html/loleaflet.html.m4 b/loleaflet/html/loleaflet.html.m4
index bee43b754..273a05605 100644
--- a/loleaflet/html/loleaflet.html.m4
+++ b/loleaflet/html/loleaflet.html.m4
@@ -94,7 +94,14 @@ m4_dnl In the debug case, just write all the .css files here
 m4_ifelse(DEBUG,[true],
   m4_foreachq([fileCSS],[LOLEAFLET_CSS],[<link rel="stylesheet" href="][m4_ifelse(MOBILEAPP,[],[%SERVICE_ROOT%/loleaflet/%VERSION%/])][fileCSS" />
 ]),
-  [<style>m4_syscmd([cat ]BUNDLE_CSS)</style>
+  [<!-- Dynamically load the bundle.css -->
+<script>
+var link = document.createElement('link');
+link.setAttribute("rel", "stylesheet");
+link.setAttribute("type", "text/css");
+link.setAttribute("href", '][m4_ifelse(MOBILEAPP,[],[%SERVICE_ROOT%/loleaflet/%VERSION%/])][bundle.css');
+document.getElementsByTagName("head")[[0]].appendChild(link);
+</script>
 ])
 <!--%BRANDING_CSS%--> <!-- add your logo here -->
 m4_ifelse(IOSAPP,[true],


More information about the Libreoffice-commits mailing list