diff --git a/core/constants.js b/core/constants.js index 131a6dd1..d75fb9d8 100644 --- a/core/constants.js +++ b/core/constants.js @@ -432,6 +432,11 @@ const MathJax3Files = { }; const ReqAnalyzer = { + 'BUNDLE_MATHJAX': 'MathJax (Bundle)', + 'BUNDLE_TINYMCE': 'TinyMCE (Bundle)', + 'BUNDLE_DATATABLES': 'DataTables (Bundle)', + 'BUNDLE_SCROLLMAGIC': 'ScrollMagic (Bundle)', + 'BUNDLE_FONT_AWESOME': 'Font Awesome (Fonts) (Bundle)', 'BUNDLE_PURE_CSS': 'Pure CSS (Bundle)', }; diff --git a/core/request-analyzer.js b/core/request-analyzer.js index c85184fe..222bf6e7 100644 --- a/core/request-analyzer.js +++ b/core/request-analyzer.js @@ -251,15 +251,15 @@ requestAnalyzer._findLocalTarget = function (resourceMappings, basePath, channel requestAnalyzer._getPathOfBundle = function (initiator, channelHost, channelPath, targetPath, bundle) { let filename = channelPath.split('/').pop(); - if (bundle === 'MathJax (Bundle)' && filename !== 'MathJax.js') { + if (bundle === ReqAnalyzer.BUNDLE_MATHJAX && filename !== 'MathJax.js') { filename = requestAnalyzer._handleMathJax(channelPath, channelHost, initiator); - } else if (bundle === 'TinyMCE (Bundle)' && filename !== 'tinymce.min.js') { + } else if (bundle === ReqAnalyzer.BUNDLE_TINYMCE && filename !== 'tinymce.min.js') { filename = requestAnalyzer._handleTinyMCE(channelPath, channelHost, initiator); - } else if (bundle === 'DataTables (Bundle)') { + } else if (bundle === ReqAnalyzer.BUNDLE_DATATABLES) { filename = requestAnalyzer._handleUncompressedFiles(filename); - } else if (bundle === 'ScrollMagic (Bundle)' && !filename.endsWith('.min.js')) { + } else if (bundle === ReqAnalyzer.BUNDLE_SCROLLMAGIC && !filename.endsWith('.min.js')) { filename = requestAnalyzer._handleUncompressedFiles(filename); - } else if (bundle === 'Font Awesome (Fonts) (Bundle)') { + } else if (bundle === ReqAnalyzer.BUNDLE_FONT_AWESOME) { filename = requestAnalyzer._handleFontawesomeFiles(targetPath, filename); } else if (bundle === ReqAnalyzer.BUNDLE_PURE_CSS) { filename = (filename === 'pure-min.css' ? 'pure.min.css' : filename);