Skip to content

Instantly share code, notes, and snippets.

@orioltf
Created April 18, 2013 06:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save orioltf/5410711 to your computer and use it in GitHub Desktop.
Save orioltf/5410711 to your computer and use it in GitHub Desktop.
#HAML: Conditional tag attribute depending on absence of value
%li{:hidden => (nav.shown == true ? nil : '')}
@orioltf
Copy link
Author

orioltf commented Apr 18, 2013

When you return nil value for an attribute, HAML will ignore it and it will not appear in the output.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment