简体   繁体   中英

Install twitter bootstrap theme into rails 4 app - Vendor/assets directory not found?

I am attempting to install a theme from wrapbootstrap.com into my rails 4.1 application.

I created a new app with rails 4 scaffolding. I then took the downloaded zip directory which includes 4 directories and an index.html file and placed them where I thought they should go:

css moved to vendor/assets/stylesheets , js moved to vendor/assets/javascripts , font moved to vendor/assets/fonts , and img moved to vendor/assets/images .

I then added this code to me app/assets/stylesheets file:

*= require_tree ../../../vendor/assets/stylesheets/.

and this code to my app/assets/javascripts file:

//= require_tree ../../../vendor/assets/javascripts/.

At this point, I assumed I had all the files I needed in place, so I copied index.html over into my app and pointed my browser to the appropriate view. Basically all I see is plain text - The css/javascript/image files are not working as intended.

When looking at my google Chrome developer tools, I see a bunch of errors similar to this one:

GET http://localhost:3000/vendor/assets/stylesheets/bootstrap.min.css 404 (Not Found)

What am I missing here to get this theme to work?

EDIT:

my html file looks like this where I am requiring the files:

<!-- Styles -->
        <!-- Bootstrap CSS -->
        <link href="../../../vendor/assets/stylesheets/bootstrap.min.css" rel="stylesheet">
        <!-- Font awesome CSS -->
        <link href="../../../vendor/assets/stylesheets/font-awesome.min.css" rel="stylesheet">
        <!-- Pretty Photo -->
        <link href="../../../vendor/assets/stylesheets/prettyPhoto.css" rel="stylesheet">
        <!-- Animate -->
        <link href="../../../vendor/assets/stylesheets/animate.min.css" rel="stylesheet">
        <!-- Custom CSS -->
        <link href="../../../vendor/assets/stylesheets/style.css" rel="stylesheet">

不要将供应商路径放在href中,只需添加常规<%= stylesheet_link_tag 'application', media: 'all' %>并在application.css文件中包括其他CSS。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM