Skip to content

Commit e7c5f99

Browse files
fix: apply reset css only for playground
1 parent 8d278a8 commit e7c5f99

File tree

2 files changed

+15
-6
lines changed

2 files changed

+15
-6
lines changed

website/src/App.vue

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,28 @@ import Toast from './components/utils/Toast.vue'
44
import { shallowRef, onMounted, onUnmounted } from 'vue'
55
// vitepress SSR does not support Monaco, lazy load on client side
66
let playground = shallowRef<unknown>(null)
7+
8+
// setup global style
9+
import styles from './style.css?inline'
10+
const styleId = 'playground-style'
11+
function insertStyle() {
12+
const style = document.createElement('style')
13+
style.id = styleId
14+
style.textContent = styles
15+
document.head.appendChild(style)
16+
}
17+
718
onMounted(async () => {
819
// apply playground style override, see style.css
20+
insertStyle()
921
document.body.classList.add('playground')
1022
playground.value = (await import('./components/Playground.vue')).default
1123
})
1224
onUnmounted(() => {
13-
// apply playground style override, see style.css
25+
// remove playground style override
1426
document.body.classList.remove('playground')
27+
const style = document.getElementById(styleId)
28+
style?.remove()
1529
})
1630
</script>
1731

@@ -35,8 +49,6 @@ onUnmounted(() => {
3549
</div>
3650
</template>
3751

38-
<style src="./style.css"/>
39-
4052
<style scoped>
4153
.logo {
4254
height: 9em;

website/src/components/Playground.vue

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,6 @@ import Toolbars from './Toolbars.vue'
99
import EnvDisplay from './EnvDisplay.vue'
1010
import { initializeParser, useAstGrep, Mode as ModeImport } from './astGrep'
1111
12-
// setup global style
13-
import '../style.css'
14-
1512
// important initialization
1613
await initializeParser()
1714

0 commit comments

Comments
 (0)