* @param {string} mode * @param {string} html * @param {string=} hostName * @return {string}
(mode, html, hostName = '')
| 133 | * @return {string} |
| 134 | */ |
| 135 | function replaceUrls(mode, html, hostName = '') { |
| 136 | // If you need to add URL mapping logic, please don't do it in this function. |
| 137 | // Instead, do so in the `cdn.ts` module required by `replaceCdnJsUrls()` |
| 138 | |
| 139 | const useMaxNames = mode !== 'minified'; |
| 140 | if (!useMaxNames) { |
| 141 | // TODO(alanorozco): This should be handled in new-server as well. |
| 142 | html = html.replace( |
| 143 | /\/dist.3p\/current\/(.*)\.max.html/g, |
| 144 | hostName + '/dist.3p/current-min/$1.html' |
| 145 | ); |
| 146 | } |
| 147 | return replaceCdnJsUrls(mode, html, hostName, useMaxNames); |
| 148 | } |
| 149 | |
| 150 | module.exports = { |
| 151 | getServeMode, |
no test coverage detected