To cover for relative ./assets paths, I used this instead. You can remove all the String(...).replace in the above code and replace with this (6 to 3 lines by account for single and double-quotes in the same regex).
./assets
content = String(content).replace(/src=["'][.]{0,1}\//g, `src="${PRODUCTION_URL}`); content = String(content).replace(/href=["'][.]{0,1}\//g, `href="${PRODUCTION_URL}`); content = String(content).replace(/url\(["'][.]{0,1}\//g, `url("${PRODUCTION_URL}`);
Great, thanks!
Are you sure you want to hide this comment? It will become hidden in your post, but will still be visible via the comment's permalink.
Hide child comments as well
Confirm
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
To cover for relative
./assets
paths, I used this instead. You can remove all the String(...).replace in the above code and replace with this (6 to 3 lines by account for single and double-quotes in the same regex).Great, thanks!