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.

Support `.html.tpl` as HTML files

See original GitHub issue

Environments:

  • Prettier Version: 1.15.1
  • Running Prettier via: CLI (in my case, but this affects all)
  • Runtime: N/A
  • Operating System: N/A

It is common to see .html.tpl files being installed/used by build tools, and in most cases these are valid HTML files. Would it be reasonable to support this specific extension with the html parser?

We are using the following configuration at the moment:

  overrides: [
    {
      files: '*.html.tpl',
      options: { parser: 'html' },
    },
  ],

but it would be nice if Prettier was opinionatedly considering these as HTML by default. Thoughts?

Issue Analytics

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

github_iconTop GitHub Comments

2reactions
michaeljotacommented, Nov 9, 2018

Through I does work with that example, it doesn’t mean this would work in all scenarios. Template languages are not supported yet by Prettier, but Angular’s and Vue’s.

If you are sure your files are HTML compatible, then use the workaround you proposed, but I don’t think is a good idea for this be the default behavior, as it could lead to unintended formatting.

1reaction
astorijecommented, Nov 10, 2018

All very good points. The first example I have should always be valid HTML so my workaround will work, and the second project is being rewritten in Vue so it’s not worth the effort until the rewrite is finished. I’m going to close this because it makes sense and I have a workaround. If someone is looking for something similar, this issue / arguments will now show up in the search results.

Thanks!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Visual Studio Code: Treat other extensions as HTML
There is a setting files.associations that can be used to assign file patterns to languages. ... for example '.tpl': 'text/html'; save and restart...
Read more >
Creating node templates - the tpl html files - Quanta CMS
Creating a template file. Creating a basic template for a node, is quite easy: just add a tpl.html file inside its related folder....
Read more >
What is .tpl file in PHP web design? - GeeksforGeeks
TPL is a template file which is a common text file that contains user-defined variables that are entitled to be overridden by user-defined ......
Read more >
Display .tpl files as simple html+php files
I'm using a cms where template files have .tpl extension, but they don't use any templating engine like Smarty, those are just simple......
Read more >
Template Files .tpl versus .html files | SEO Forum - Moz
We sell a large selection of Insulation Products use template files (.tpl) to collect up-to-date information from a server side database file ......
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