Download the stuff and put it in the public/ folder. I made a bootstrap folder in my public folder to keep it organize. Don't forgot to also get jquery. Bootstrap doesn't work without jquery. This is the easy part.
The next part is kinda hit or miss: Jade
Nodejs with Express uses a templating engine to make views. There are a couple of options but jade is the default. I say hit or miss is because some take to Jade like ducklings to water. Some of you might not be ducklings.
Here's a sample:
nav(class='navbar navbar-default navbar-static-top') .container .navbar-header button(type='button', class='navbar-toggle collapsed', data-toggle='collapse', data-target='#navbar', aria-expanded='false', aria-controls='navbar') span(class='sr-only') Toggle navigation span(class='icon-bar') span(class='icon-bar') span(class='icon-bar') a(class='navbar-brand', href='#')= title div(id='navbar',class='navbar-collapse collapse') ul.nav.navbar-nav li.active a(href='#') Home li a(href='#') About li a(href='#') Contact
Jade templating language is quite terse to write compared to raw HTML. It also has a few fun parts like includes, conditionals and mixins.
In the Views/ folder, I made a shared folder and move the common stuff like the layout and navbars. This way I can compose the view like lego bricks AND that's where the fun starts.
Clone the repo at Github.
No comments:
Post a Comment