svelte-preprocess icon indicating copy to clipboard operation
svelte-preprocess copied to clipboard

non-mandatory pug

Open endigma opened this issue 3 years ago • 4 comments

Is your feature request related to a problem? Please describe. The ability to only parse

Describe the solution you'd like Optionally, only use pug on template or the set tag

endigma avatar Jan 28 '22 16:01 endigma

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

endigma avatar Jan 28 '22 16:01 endigma

oddly, also seems to work this way with the automatic preprocessor instead of using explicit syntax

endigma avatar Jan 28 '22 16:01 endigma

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: pug and pugMarkup or 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.

kaisermann avatar Jan 28 '22 17:01 kaisermann

For my particular use case having onlyParseTags: bool or something would be helpful.

endigma avatar Jan 28 '22 18:01 endigma