Haml comments

Well even though I am not a big fan of Haml, all my co-workers are, so in all of my work projects I have to write haml (and see / deal with emblem.js code as far as I am dealing with ember and handlebars).

One thing that I forget all the time is the comments in haml. If you just select them and push ctrl+/ (sublime text shortcut for adding comments in any language) it will add / in front of the haml line of code. But this kind of comment is an html comment which means it will show the code and serve it to the user. If you want to hide the comments from the user, you have to put it as a ruby comment like this: -#.

So as a reference here is my note.
HTML comments in Haml (appear on user as html comment):

      / #google.tab-pane
      /   .controls.filter_controls
      /     %label Find Image from Google
      /     %input.filter_google_library{"type" => "text", "value" => @product.name}
      /     %input.btn.btn-success.google_search{"type" => "submit", "value" => "Search Google"}
      /     .google_images
Ruby comments in Haml (won't appear on user):
      -# #google.tab-pane
      -#   .controls.filter_controls
      -#     %label Find Image from Google
      -#     %input.filter_google_library{"type" => "text", "value" => @product.name}
      -#     %input.btn.btn-success.google_search{"type" => "submit", "value" => "Search Google"}
      -#     .google_images

comments powered by Disqus