From 3af10733cc19b8030bc7d0537ecae0aa9b7788c0 Mon Sep 17 00:00:00 2001 From: Alasdair Smith Date: Wed, 11 Apr 2018 12:36:47 +0100 Subject: [PATCH] Replace hard coded rich text hashed file path with registration system --- .../web/app/coffee/infrastructure/ExpressLocals.coffee | 4 ++-- services/web/app/coffee/infrastructure/Modules.coffee | 7 +++++++ 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/services/web/app/coffee/infrastructure/ExpressLocals.coffee b/services/web/app/coffee/infrastructure/ExpressLocals.coffee index 0855a35c74..37cce62ddd 100644 --- a/services/web/app/coffee/infrastructure/ExpressLocals.coffee +++ b/services/web/app/coffee/infrastructure/ExpressLocals.coffee @@ -15,6 +15,7 @@ htmlEncoder = new require("node-html-encoder").Encoder("numerical") hashedFiles = {} Path = require 'path' Features = require "./Features" +Modules = require "./Modules" jsPath = if Settings.useMinifiedJs @@ -41,10 +42,9 @@ pathList = [ "#{jsPath}ide.js" "#{jsPath}main.js" "#{jsPath}libraries.js" - "#{jsPath}es/rich-text.js" "/stylesheets/style.css" "/stylesheets/ol-style.css" -] +].concat(Modules.moduleAssetFiles(jsPath)) if !Settings.useMinifiedJs logger.log "not using minified JS, not hashing static files" diff --git a/services/web/app/coffee/infrastructure/Modules.coffee b/services/web/app/coffee/infrastructure/Modules.coffee index 9d4da24c8b..769182ad94 100644 --- a/services/web/app/coffee/infrastructure/Modules.coffee +++ b/services/web/app/coffee/infrastructure/Modules.coffee @@ -43,6 +43,13 @@ module.exports = Modules = moduleIncludesAvailable: (view) -> return (Modules.viewIncludes[view] or []).length > 0 + moduleAssetFiles: (pathPrefix) -> + assetFiles = [] + for module in @modules + for assetFile in module.assetFiles or [] + assetFiles.push "#{pathPrefix}#{assetFile}" + return assetFiles + attachHooks: () -> for module in @modules if module.hooks?