sveltejs / svelte-preprocess

A ✨ magical ✨ Svelte preprocessor with sensible defaults and support for: PostCSS, SCSS, Less, Stylus, Coffeescript, TypeScript, Pug and much more.
MIT License
1.75k stars 151 forks source link

Pug linting / compiling errors #117

Closed ghost closed 4 years ago

ghost commented 4 years ago

I want to begin with saying your work is absolutely amazing... anyway, when using pug, I often forget to use escaped attributes, for example, .active(hidden="{!please.work}"), which needs !=. When developing, the error is "(plugin svelte) ParseError: Expected }" and then points to the single line of minified HTML... when not using pug, this will point to the actual line of invalid HTML. Shouldn't something like pug.render({ pretty: (production ? false : ' ') }) be used? to alleviate this issue... As in, use pretty HTML for development, so that the broken line can be pointed at. Pug errors are displayed correctly - the issue is when the handlebar expressions are evaluated. Thanks!

kaisermann commented 4 years ago

Hey @admholmes 👋 Sorry for taking so long to answer. I've search a bit about the pretty options and it seems it's buggy and probably deprecated. I understand your problem, but I don't think using a deprecated feature is best solution. Maybe we could run the output through a beautifier or something alike (just came to my mind that this shouldn't work with svelte's syntax blocks). However, you're free to pass a pretty: true to the pug options object in your preprocess config 😁