From 304eb88f15e10015856a2f5eca4c1e5bc4deb340 Mon Sep 17 00:00:00 2001 From: Kevin Ring Date: Fri, 8 Jul 2016 12:25:23 +1000 Subject: [PATCH] Break the `sourceMappingURL` string to avoid confusing Chrome. --- addStyles.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/addStyles.js b/addStyles.js index ef4fd5fd..8168dfa0 100644 --- a/addStyles.js +++ b/addStyles.js @@ -232,7 +232,9 @@ function updateLink(linkElement, obj) { if(sourceMap) { // http://stackoverflow.com/a/26603875 - css += "\n/*# sourceMappingURL=data:application/json;base64," + btoa(unescape(encodeURIComponent(JSON.stringify(sourceMap)))) + " */"; + // The seemingly-unnecessary break between 'source' and 'Mapping' is to prevent Chrome 51 (at least) from + // trying to interpret this code as an actual source map reference. + css += "\n/*# source" + "MappingURL=data:application/json;base64," + btoa(unescape(encodeURIComponent(JSON.stringify(sourceMap)))) + " */"; } var blob = new Blob([css], { type: "text/css" });