Press n or j to go to the next uncovered block, b, p or k for the previous block.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | 2x 2x 6x 2x 5x 2x 6x 5x 5x | const WEBP_REGEXP = /^(~images)([\w\d/\-_]+)(\.[jpe?g|png]+)/ const checkReplaceTo = replaceTo => replaceTo && typeof replaceTo === 'function' const replaced = (path = '~webp') => { return path + '$2.webp' } module.exports = ({ replaceTo, webpPath }, { file, folder, url }) => { if (checkReplaceTo(replaceTo)) return replaceTo({ file, folder, url }) let replacer = replaceTo || WEBP_REGEXP return url.replace(replacer, replaced(webpPath)) } |