Merge pull request #10174 from BerkeleyTrue/fix/add-head-tail

Fix(challenge): Add challenge head/tail to contents on execute
This commit is contained in:
Jonathan
2016-08-12 14:39:07 +02:00
committed by GitHub

View File

@ -79,7 +79,7 @@ function cacheLink({ link } = {}, crossDomain = true) {
const htmlCatch = '\n<!--fcc-->'; const htmlCatch = '\n<!--fcc-->';
const jsCatch = '\n;/*fcc*/'; const jsCatch = '\n;/*fcc*/\n';
export default function executeChallengeSaga(action$, getState) { export default function executeChallengeSaga(action$, getState) {
const frameRunner$ = cacheScript( const frameRunner$ = cacheScript(
@ -103,14 +103,19 @@ export default function executeChallengeSaga(action$, getState) {
// createbuild // createbuild
.flatMap(file$ => file$.reduce((build, file) => { .flatMap(file$ => file$.reduce((build, file) => {
let finalFile; let finalFile;
const finalContents = [
file.head,
file.contents,
file.tail
];
if (file.ext === 'js') { if (file.ext === 'js') {
finalFile = setExt('html', updateContents( finalFile = setExt('html', updateContents(
`<script>${file.contents}${jsCatch}</script>`, `<script>${finalContents.join(jsCatch)}${jsCatch}</script>`,
file file
)); ));
} else if (file.ext === 'css') { } else if (file.ext === 'css') {
finalFile = setExt('html', updateContents( finalFile = setExt('html', updateContents(
`<style>${file.contents}</style>`, `<style>${finalContents.join(htmlCatch)}</style>`,
file file
)); ));
} else { } else {