From ddc4fb32b1763b846b913d693a860f5c878cc02f Mon Sep 17 00:00:00 2001 From: Cassie Tarakajian Date: Fri, 11 Nov 2016 17:36:19 -0500 Subject: [PATCH] injects S3 CSS/JS files properly into preview, as found in #196 --- client/modules/IDE/components/PreviewFrame.jsx | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/client/modules/IDE/components/PreviewFrame.jsx b/client/modules/IDE/components/PreviewFrame.jsx index a858925d..d53021f1 100644 --- a/client/modules/IDE/components/PreviewFrame.jsx +++ b/client/modules/IDE/components/PreviewFrame.jsx @@ -233,14 +233,25 @@ class PreviewFrame extends React.Component { jsFiles.forEach(jsFile => { const fileName = escapeStringRegexp(jsFile.name); const fileRegex = new RegExp(`([\s\S]*?)<\/script>`, 'gmi'); - const replacementString = ``; + let replacementString; + if (jsFile.url) { + replacementString = ``; + } else { + replacementString = ``; + } htmlFile = htmlFile.replace(fileRegex, replacementString); }); cssFiles.forEach(cssFile => { const fileName = escapeStringRegexp(cssFile.name); const fileRegex = new RegExp(``, 'gmi'); - htmlFile = htmlFile.replace(fileRegex, ``); + let replacementString; + if (cssFile.url) { + replacementString = ``; + } else { + replacementString = ``; + } + htmlFile = htmlFile.replace(fileRegex, replacementString); }); const htmlHead = htmlFile.match(/(?:)([\s\S]*?)(?:<\/head>)/gmi);