Getting back into the hang of HAML with my new full-stack position at Orbit. I will probably write a bunch of small tips I learn along the way — mostly so I can have a place to reference them!
Adding a line of only a period does not work well in haml.
= link_to "click link", "#", target: :_blank, rel: :noreferrer
.
This code returns: Illegal element: classes and ids must have values
= link_to "click link", "#", target: :_blank, rel: :noreferrer
\.
This snippet does not produce an error, but it gives us a blank space between the text and the period. click link .
= link_to("click link", "#", target: :_blank, rel: :noreferrer) + "."
Concatenating a period onto the link text works perfectly, just remember to add the parentheses to the link_to args so it doesn’t treat the + "."
as an invalid argument.