1
votes

I've tried to integrate bootstrap following this procedure found on stackoverflow (my rails version is the 3.2.17, this is a difference), so without a gem but just including the bootstrap files in the relevant project directories.
Then i've created an HTML page and i put it in the project public directory.
This is the code:


<!DOCTYPE html>
<html>
<head>
    <title>Bootsrap Test 01</title>
    <link rel="stylesheet" href="css/bootstrap.css">
    <script src="js/bootstrap.min.js" type="text/javascript"></script>
</head>

...

But when i load the page and inspect it (it loads) i can see that the GETs produces the errors below:

GET http://localhost:3000/css/bootstrap.css 404 (Not Found) 
GET http://localhost:3000/js/bootstrap.min.js 404 (Not Found) 
2
did you restart your server?PhillipKregg
yes, i restarted the server.AgostinoX

2 Answers

2
votes

From the error i think your app try to find bootstrap.css in a folder called css inside your public directory and another file called bootstrap.min.js in a folder called js inside the public directory too, so verify if this is what you are doing :)

this is my preferred way for adding bootstrap to Rails app :

  1. copy bootstrap.min.css to /vendor/assets/stylesheets
  2. copy bootstrap.min.js to /vendor/assets/javascripts
  3. copy fonts directory to /vendor/assets/

then add this line : *= require bootstrap.min to app/assets/stylesheets/application.css file like this :

 *= require bootstrap.min
 *= require_self
 *= require_tree .

and also add //= require bootstrap.min to app/assets/javascripts/application.js file like this :

//= require jquery
//= require jquery_ujs
//= require bootstrap.min
//= require_tree .

Restart your server and that's it.

Hope this help

1
votes

The path is not:

css/bootstrap.css

but

assets/bootstrap.css