mirror of https://github.com/sveltejs/svelte
This parameter will hold the entire processed source file up until the current preprocessor. Fixes #4912pull/4913/head
parent
f46b38a308
commit
17a3e28855
@ -0,0 +1,12 @@
|
|||||||
|
export default {
|
||||||
|
preprocess: {
|
||||||
|
script: ({ content, markup }) => {
|
||||||
|
return {
|
||||||
|
code: content.replace(
|
||||||
|
"__HASDIVTAG__",
|
||||||
|
markup && /<div\/>/g.test(markup) ? "'yes'" : "'no'"
|
||||||
|
),
|
||||||
|
};
|
||||||
|
},
|
||||||
|
},
|
||||||
|
};
|
@ -0,0 +1,5 @@
|
|||||||
|
<script>
|
||||||
|
console.log(__HASDIVTAG__);
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<div/>
|
@ -0,0 +1,5 @@
|
|||||||
|
<script>
|
||||||
|
console.log('yes');
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<div/>
|
Loading…
Reference in new issue