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.

.erb format support

See original GitHub issue

Wondering if there’s any plans for this plugin to support .erb format?

Prettier already supports .html format but if passed .html.erb it fails.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:17
  • Comments:15 (6 by maintainers)

github_iconTop GitHub Comments

17reactions
iankscommented, Nov 19, 2020

I think it’s really close actually! It does not seem to be breaking our HTML at all, just a few small styling nits and i think this could be shipped.

Formatting Inline Ruby

A: If we format a file with this content:

<%= render partial: 'shared/search_header', locals: { search_url: routes.retailers_path } %>

<%= form %>

B: Prettier will output:

<%= render partial: 'shared/search_header', locals: { search_url: routes.retailers_path } %> <%= form %>

This isn’t wrong; it’s fully syntactically valid. However, I think the A output looks better. Would it make sense to treat the inline ruby <% tags the same way as a br /> is treated, so it will keep the line breaks?

12reactions
kddnewtoncommented, Aug 8, 2019

Yeah absolutely! Still working on how to make that work exactly. Currently there isn’t a lot of support for templating languages in general. There’s some discussion going on w/r/t prettier as a whole, so I’m following that.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Language: Embedded Ruby (ERB) template syntax - Puppet
An ERB template looks like a plain-text document interspersed with tags containing Ruby code. When evaluated, this tagged code can modify text in...
Read more >
class ERB - Documentation for Ruby 2.3.0
ERB provides an easy to use but powerful templating system for Ruby. Using ERB , actual Ruby code can be added to any...
Read more >
ERB File Extension - What is an .erb file and how do I open it?
ERB is often used for templating Web files such as .RB, .RHTML, .HTML, and .JS files. Open over 150 file formats with File...
Read more >
An Introduction to ERB Templating - Field Notes
ERB templates combine plain text with Ruby code for variable substitution and flow control, making them easy to write and maintain. Although ERB...
Read more >
What is an ERB file? - Online converter
ERB files contain source code written in a programming language of the same name. The ERB language is essentially a Ruby templating language....
Read more >

github_iconTop Related Medium Post

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 Hashnode Post

No results found