svelte-preprocess
svelte-preprocess copied to clipboard
non-mandatory pug
Is your feature request related to a problem? Please describe.
The ability to only parse is already implemented, but I can't set it to ONLY do <template lang=pug>. It seems while using the pug preprocessor writing normal tag syntax is forbidden.
Describe the solution you'd like
Optionally, only use pug on template or the set tag
doing
<script>
console.log("hello")
</script>
<p>hello</p>
<template>
</template>
allows tag syntax again, but an option to just ignore files with no template would be great
oddly, also seems to work this way with the automatic preprocessor instead of using explicit syntax
Hey @endigma 👋
oddly, also seems to work this way with the automatic preprocessor instead of using an explicit syntax
This is intended because with the automatic preprocess, we can't know if the user wants to parse the whole file or just the template tag, which is why it only parses the template tag. You're correct that adding a <template> tag prevents the pug preprocessor from trying to parse the whole file.
We have four options IMO:
- Separate pug preprocessors:
pugandpugMarkupor something. - Add a new option to the pug preprocessor, name to be defined, that defines if the whole markup should be parsed or not.
- I don't have enough data to support this one, but I hardly think that folks are using pug for both style/script tags, so we could remove this whole markup parsing altogether. This would be, of course, a breaking-change, but we're due to one for a while.
- Make the pug preprocessor ignore style/script tags and parse only the rest. Also breaking though.
For my particular use case having onlyParseTags: bool or something would be helpful.