The slim documentation says you can add a role attribute by using the @
character, but I am getting syntax compile errors in my browser when doing that.
Example from https://github.com/slim-template/slim
We can use it in Slim code like this
.person@admin = person.name
which renders to
<div class="person" role="admin">Daniel</div>
My Code:
#navbar.affixable.navbar.navbar-default@navigation
=link_to "G Who Said That", root_path
ul.nav.navbar-nav
li =link_to "About", about_path
This is a custom shortcut and you need to define it before using it. You can define it by:
Slim::Engine.set_default_options :shortcut => {'@' => {:attr => 'role'}, '#' => {:attr => 'id'}, '.' => {:attr => 'class'}}
Couldn't find documentation on where to define it, give it a try in application.rb and if it doesn't work then you can use normal approach
#navbar.affixable.navbar.navbar-default{role: "navigation"}