diff --git a/playgrounds/sandbox/run.js b/playgrounds/sandbox/run.js index be6e7d05bd..e387bd44e7 100644 --- a/playgrounds/sandbox/run.js +++ b/playgrounds/sandbox/run.js @@ -34,22 +34,11 @@ for (const generate of ['client', 'server']) { const input = `${cwd}/input/${file}`; const source = fs.readFileSync(input, 'utf-8'); - const compiled = compile(source, { - filename: input, - generate, - runes: argv.runes - }); - const output_js = `${cwd}/output/${generate}/${file}.js`; const output_css = `${cwd}/output/${generate}/${file}.css`; mkdirp(path.dirname(output_js)); - fs.writeFileSync(output_js, compiled.js.code); - if (compiled.css) { - fs.writeFileSync(output_css, compiled.css.code); - } - if (generate === 'client') { const ast = parse(source, { modern: true @@ -57,6 +46,17 @@ for (const generate of ['client', 'server']) { fs.writeFileSync(`${cwd}/output/${file}.json`, JSON.stringify(ast, null, '\t')); } + + const compiled = compile(source, { + filename: input, + generate, + runes: argv.runes + }); + + fs.writeFileSync(output_js, compiled.js.code); + if (compiled.css) { + fs.writeFileSync(output_css, compiled.css.code); + } } for (const file of js_modules) {