question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Pug plugin doesn't work for the .vue files

See original GitHub issue

Environments:

  • Prettier Version: 1.18.2
  • Running Prettier via: CLI
  • Runtime: node.js v8.15.0
  • Operating System: MacOS

Steps to reproduce:

Expected behavior: Template inside the pug.vue should be prettified

Actual behavior: template inside the pug.vue isn’t touched by prettier

If you run prettier --write *.pug, you can see that the plugin itself works perfectly. The plugin developers suggested to write here: (https://github.com/prettier/plugin-pug/issues/5)

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:10
  • Comments:26 (19 by maintainers)

github_iconTop GitHub Comments

19reactions
alexander-akaitcommented, Nov 5, 2019

/cc @prettier/core thoughts?

13reactions
xavxyzcommented, Oct 1, 2019

👋, @prettier/core team! I may have found a hint for people wanting to use @prettier/plugin-pug and Vue templates.

https://github.com/prettier/prettier/issues/5371 references a time when there were troubles with Vue templates written with Pug, Prettier formatting Pug templates as HTML templates.

As far as I understand, it got fixed by ignoring template tags with a lang attribute different to html thanks to a shouldPreserveElementContent function: https://github.com/prettier/prettier/pull/5388/files#diff-0558c7e4048f9cad5b9156aecca77883R40-R47

Should a modification be done directly to shouldPreserveElementContent in prettier/language-html/utils to check for other kind of templating engines depending on the plugins installed?

Or in prettier/language-html/syntax-vue ?

@Shinigami92 (maintainer of @prettier/plugin-pug) also suggested in https://github.com/prettier/plugin-pug/issues/5#issuecomment-536993369:

In my opinion I would suggest to create something like prettier/language-pug/utils.

I would be happy to help for this issue, but I don’t know where to start (yet)! 💯

Read more comments on GitHub >

github_iconTop Results From Across the Web

Vue plugin misbehaving when used with Pug
Explanation of the problem. The Pug code in your question doesn't result in the same HTML as your "Working code." (At least in...
Read more >
vue-pug-plugin
Pug to HTML plugin for Vue with proper native pug syntax support. Latest version: 2.0.3, last published: 2 months ago.
Read more >
Pug.js tutorial: A beginner's guide with examples
In this Pug.js tutorial, we'll show you how to integrate Vue.js into a backend app using Pug as a templating engine and Express.js....
Read more >
Vue JavaScript Tutorial in Visual Studio Code
Vue JavaScript tutorial showing IntelliSense, debugging, and code navigation support in the Visual Studio Code editor.
Read more >
Using Pre-Processors - Vue Loader
Any content inside the block will be processed by webpack as if it's inside a *.scss file. # Sass vs SCSS. Note that...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found