Bootstrap Installation & Application

Installation: Bootstrap


  1. Add it to Gemfile
gem 'bootstrap-sass'
  1. Execute
    bundle install
    rails s

  2. Rename css file: application.css => application.scss, by executing
    mv app/assets/stylesheets/application.css app/assets/stylesheets/application.scss

  3. Mount it to file: app/assets/stylesheets/application.scss, by adding

@import "bootstrap-sprockets";
@import "bootstrap";


Application in project


  1. Generate views for: navbar & footer, by executing
    mkdir app/views/common
    touch app/views/common/_navbar.html.erb
    touch app/views/common/_footer.html.erb
  2. Fill content for file: app/views/common/_navbar.html.erb

  1. Fill content for file: app/views/common/_footer.html.erb

Copyright ©2017 JDStore
Design by Sarah Wu

  1. Modify content in file: app/views/layouts/application.html.erb
...
    

+    
+ <%= render "common/navbar" %> + <%= yield %> +
+ <%= render "common/footer" %>

你可能感兴趣的:(Bootstrap Installation & Application)