MCPcopy
hub / github.com/ampproject/amphtml / replaceUrls

Function replaceUrls

build-system/server/app-utils.js:135–148  ·  view source on GitHub ↗

* @param {string} mode * @param {string} html * @param {string=} hostName * @return {string}

(mode, html, hostName = '')

Source from the content-addressed store, hash-verified

133 * @return {string}
134 */
135function 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
150module.exports = {
151 getServeMode,

Callers 6

amp4test.jsFile · 0.70
runVideoTestBenchFunction · 0.70
proxyToAmpProxyFunction · 0.70
app.jsFile · 0.70
a4a-envelopes.jsFile · 0.50
app-utils.test.jsFile · 0.50

Calls 2

replaceCdnJsUrlsFunction · 0.85
replaceMethod · 0.45

Tested by

no test coverage detected