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.

Option to let Prettier format files with additional extensions? (e.g. .eex)

See original GitHub issue

I need to format .html.eex files, which are view templates for Elixir. They are mostly HTML anyways, and if I manually change the language to HTML then run Prettier, the output seems fine.

Is there a way to let .html.eex be treated like .html files by Prettier? For now I’ve only seen options to disable formatting certain extensions/languages, but not enable formatting on additional extensions.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:8 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
jeff-kilbridecommented, Nov 11, 2018

I am also having issues with handlebars (*.hbs) files. I would like prettier to format them as html, but not change the language association in vscode due to syntax highlighting. I was hoping to use an override in my .prettierrc.json file like this:

  "overrides": [
    {
      "files": "*.hbs",
      "options": {
        "parser": "html"
      }
    }
  ]

But this doesn’t work. Does this extension honor the “overrides” key in prettier config files?

I can get the formatting to work using the following in my vscode user settings:

  "files.associations": {
    "*.hbs": "html"
  },

But, again, this turns off my syntax highlighting for {{variables}}, {{> blocks}}, etc… It would be much nicer to do this through the prettier config, if possible.

0reactions
github-actions[bot]commented, Apr 23, 2020

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Options - Prettier
If you change any options, it's recommended to do it via a configuration file. This way the Prettier CLI, editor integrations and other...
Read more >
Prettier not formatting HTML files in VS Code - Stack Overflow
Set the formatter in dropdown (esbenp.prettier-vscode) for prettier. this can change if you are using any other formatter. Share.
Read more >
Code Formatting with Prettier in Visual Studio Code - YouTube
Formatting your code can be a hassle. Learn how to have your code automatically formatted to save yourself a lot of time and...
Read more >
Prettier extension for Visual Studio code - deBUG.to
"Format on save" to apply the format when you save your file. formatter setting. Simple example. Below is an example for a code...
Read more >
How to configure Prettier and VSCode - Gleb Bahmutov
Formatting every file as you save it is nice, but we can also format ALL source files at once using Prettier CLI. In...
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