gpt4 book ai didi

javascript - 将 twitter bootstrap 主题安装到 rails 4 应用程序中 - 找不到 vendor/ Assets 目录?

转载 作者:行者123 更新时间:2023-11-28 17:42:46 25 4
gpt4 key购买 nike

我正在尝试将来自 wrapbootstrap.com 的主题安装到我的 Rails 4.1 应用程序中。

我使用 Rails 4 脚手架创建了一个新应用。然后我将下载的 zip 目录(包括 4 个目录和一个 index.html 文件)放在我认为应该去的地方:

css 移动到 vendor/assets/stylesheetsjs 移动到 vendor/assets/javascriptsfont 移动到 vendor/assets/fontsimg 移动到 vendor/assets/images

然后我将这段代码添加到我的 app/assets/stylesheets 文件中:

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

并将此代码添加到我的 app/assets/javascripts 文件中:

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

此时,我假设我已准备好所需的所有文件,因此我将 index.html 复制到我的应用程序中,并将浏览器指向适当的 View 。基本上我看到的都是纯文本 - css/javascript/image 文件没有按预期工作。

在查看我的谷歌 Chrome 开发者工具时,我看到了一堆与此类似的错误:

获取 http://localhost:3000/vendor/assets/stylesheets/bootstrap.min.css 404(未找到)

要让这个主题发挥作用,我在这里缺少什么?

编辑:

我的 html 文件看起来像这样,我需要这些文件:

<!-- 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">

最佳答案

不要将 vendor 路径放在 href 中,只需添加正常 <%= stylesheet_link_tag 'application', media: 'all' %>并在 application.css 文件中包含其他 css`

关于javascript - 将 twitter bootstrap 主题安装到 rails 4 应用程序中 - 找不到 vendor/ Assets 目录?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23773821/

25 4 0
文章推荐: javascript - 搜索字符串中括号之间的内容
文章推荐: css - 防止 Bootstrap 导航栏在调整为小窗口时向下跳转
文章推荐: html - 使用css将图像任意放置在另一个图像上
文章推荐: php - 如何将 CGRIDVIEW 中生成的表包含到 YII 中的
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com