From c866f7ac77c75264bd8335baea6b16ab2827b062 Mon Sep 17 00:00:00 2001 From: John McLear Date: Sun, 21 Jun 2015 11:58:12 +0100 Subject: [PATCH] working include of plugin javascript files --- src/node/hooks/express/specialpages.js | 36 ++++++++++++++------------ 1 file changed, 20 insertions(+), 16 deletions(-) diff --git a/src/node/hooks/express/specialpages.js b/src/node/hooks/express/specialpages.js index 26fd79af1..daec84492 100644 --- a/src/node/hooks/express/specialpages.js +++ b/src/node/hooks/express/specialpages.js @@ -108,27 +108,31 @@ function sendPadHeaderFiles(res, callback){ }); }); + // Now we need to uniquify the array so we only have unique paths var uniquePaths = pluginPaths.filter(function(item, pos) { return pluginPaths.indexOf(item) == pos; }) - console.warn("paths", uniquePaths); + // Next to join the array into a string so we can add it to the link value + var uniquePluginString = "'"; - // Now we need to uniquify the array + for (var i = 0; i < uniquePaths.length; i++) { + uniquePluginString += "<"+uniquePaths[i]+".js>; rel=prefetch\,"; + } - res.set('Link', '; rel=prefetch \, \ - ; rel=prefetch \, \ - ; rel=prefetch \, \ - ; rel=prefetch \, \ - ; rel=prefetch \, \ - ; rel=prefetch \, \ - ; rel=prefetch \, \ - ; rel=prefetch \, \ - ; rel=prefetch \, \ - ; rel=prefetch \, \ - ; rel=prefetch \, \ - ; rel=prefetch \, \ - ; rel=prefetch \, \ - ; rel=prefetch'); + res.set('Link', uniquePluginString + " ; rel=prefetch\, \ +; rel=prefetch\, \ +; rel=prefetch\, \ +; rel=prefetch\, \ +; rel=prefetch\, \ +; rel=prefetch\, \ +; rel=prefetch\, \ +; rel=prefetch\, \ +; rel=prefetch\, \ +; rel=prefetch\, \ +; rel=prefetch\, \ +; rel=prefetch\, \ +; rel=prefetch\, \ +; rel=prefetch'"); callback(); }