Search code examples
ruby-on-railsrubytwitter-bootstrapcloud9-ide

How to resolve bootstrap not being applied on rails application developed on cloud9 ide?


I'm a beginner in developing applications using Ruby on Rails and I'm currently signed up and using Cloud9 as my development IDE.

I've created my first Rails project without a hitch and I'm following a tutorial on how to create a Rails website applying bootstrap.

I've installed the necessary gems bootstrap-sass and autoprefixer-rails, renamed my application.css to application.css.scss, added @import "bootstrap-sprockets" & @import "bootstrap", added //= require bootstrap-sprockets to application.js and added a navbar copied directly from the bootstrap homepage.

The tutorial I've been following is this youtube tutorial video:

https://www.youtube.com/watch?v=v002f5-9hx8

The problem is that after saving all changes and even after restarting my rails server, bootstrap never seems to be applied and I can't get it to work in my application. Any insights on this problem which may help me to resolve it. I've been trying to search google but it seems that it's a rare case so I can't find any good information to solve this problem.


Solution

  • There are several possibilities for your issue, however, we dont have enough info to help. Useful info would be: Rails version, ruby version, a quick look at your gem-file etc.

    For the interim, just use these CDN's in your application.html.erb file in the layouts.

    CSS: <link rel='stylesheet' href="ttps://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/css/bootstrap.min.css">

    JS: <script src='https://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/js/bootstrap.min.js'></script>

    Things to definitely check:

    • Gemfile syntax (http://bundler.io/gemfile.html)
    • Whether your config file (application.css/js files)for the asset pipeline is set-up correctly.
    • If you have any simple syntax issues anywhere. (I know, this is redundant.)