diff --git a/client/src/templates/Challenges/rechallenge/builders.js b/client/src/templates/Challenges/rechallenge/builders.js index 3ea596c579..0b9ff12ab2 100644 --- a/client/src/templates/Challenges/rechallenge/builders.js +++ b/client/src/templates/Challenges/rechallenge/builders.js @@ -14,36 +14,28 @@ import { transformContents } from '../../../../../utils/polyvinyl'; -const htmlCatch = '\n\n'; -const jsCatch = '\n;/*fcc*/\n'; -const cssCatch = '\n/*fcc*/\n'; - const defaultTemplate = ({ source }) => { return ` - - ${source} - + ${source} `; }; const wrapInScript = partial( transformContents, - content => `${htmlCatch}` + content => `` ); const wrapInStyle = partial( transformContents, - content => `${htmlCatch}` + content => `` ); const setExtToHTML = partial(setExt, 'html'); -const padContentWithJsCatch = partial(compileHeadTail, jsCatch); -const padContentWithCssCatch = partial(compileHeadTail, cssCatch); -// const padContentWithHTMLCatch = partial(compileHeadTail, htmlCatch); +const concatHeadTail = partial(compileHeadTail, ''); export const jsToHtml = cond([ [ matchesProperty('ext', 'js'), - flow(padContentWithJsCatch, wrapInScript, setExtToHTML) + flow(concatHeadTail, wrapInScript, setExtToHTML) ], [stubTrue, identity] ]); @@ -51,7 +43,7 @@ export const jsToHtml = cond([ export const cssToHtml = cond([ [ matchesProperty('ext', 'css'), - flow(padContentWithCssCatch, wrapInStyle, setExtToHTML) + flow(concatHeadTail, wrapInStyle, setExtToHTML) ], [stubTrue, identity] ]); @@ -96,12 +88,12 @@ A required file can not have both a src and a link: src = ${src}, link = ${link} const indexHtml = findIndexHtml(challengeFiles); const source = challengeFiles.reduce((source, challengeFile) => { - if (!indexHtml) return source.concat(challengeFile.contents, htmlCatch); + if (!indexHtml) return source.concat(challengeFile.contents); if ( indexHtml.importedFiles.includes(challengeFile.history[0]) || wasHtmlFile(challengeFile) ) { - return source.concat(challengeFile.contents, htmlCatch); + return source.concat(challengeFile.contents); } else { return source; } diff --git a/client/src/templates/Challenges/rechallenge/transformers.js b/client/src/templates/Challenges/rechallenge/transformers.js index eb25b6e6ae..ac43954bd3 100644 --- a/client/src/templates/Challenges/rechallenge/transformers.js +++ b/client/src/templates/Challenges/rechallenge/transformers.js @@ -105,8 +105,6 @@ async function loadPresetReact() { const babelTransformCode = options => code => Babel.transform(code, options).code; -// const sourceReg = -// /()([\s\S]*?)(?=)/g; const NBSPReg = new RegExp(String.fromCharCode(160), 'g'); const testJS = matchesProperty('ext', 'js');