Skip to content

Commit

Permalink
fix(Result): remove extra scripts added to detect classes for CSS pro…
Browse files Browse the repository at this point in the history
…cessors
  • Loading branch information
hatemhosny committed Jan 25, 2024
1 parent 3d2e5c3 commit c63a32f
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/livecodes/core.ts
Original file line number Diff line number Diff line change
Expand Up @@ -866,7 +866,8 @@ const getResultPage = async ({

const compileResults = await Promise.all([
compiler.compile(styleContent, styleLanguage, config, {
html: `${compiledMarkup}<script>${compiledScript}</script><script>${compileInfo.importedContent}</script>`,
html: `${compiledMarkup}<script type="script-for-styles">${compiledScript}</script>
<script type="script-for-styles">${compileInfo.importedContent}</script>`,
forceCompile: forceCompileStyles,
}),
runTests
Expand Down
4 changes: 4 additions & 0 deletions src/livecodes/result/result-page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,10 @@ export const createResultPage = async ({
const markup = code.markup.compiled;
dom.body.innerHTML += markup;

// cleanup extra scripts added to detect classes for CSS processors
const extra = dom.querySelectorAll('script[type="script-for-styles"]');
extra.forEach((el) => el.remove());

// cleanup custom configurations and scripts
if (code.script.language === 'blockly') {
const extra = dom.querySelectorAll(
Expand Down

0 comments on commit c63a32f

Please sign in to comment.