Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/ruby-on-rails-4/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/heroku/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ruby on rails 4 如何在rails应用程序中使用引导?_Ruby On Rails 4_Twitter Bootstrap 3 - Fatal编程技术网

Ruby on rails 4 如何在rails应用程序中使用引导?

Ruby on rails 4 如何在rails应用程序中使用引导?,ruby-on-rails-4,twitter-bootstrap-3,Ruby On Rails 4,Twitter Bootstrap 3,我刚刚在RailsBridge教程之后部署了我的第一个rails应用程序。我还学习了如何将引导添加到应用程序的教程,但我被卡住了,因为它要求您使用TOUCH命令,而我正在运行的Windows没有与TOUCH命令等效的命令。说明如下: 在命令中键入以下内容: touch app/assets/stylesheets/bootstrap_and_overrides.css.scss 然后,它告诉您打开它创建的文件并键入以下内容: @import "bootstrap"; body { paddin

我刚刚在RailsBridge教程之后部署了我的第一个rails应用程序。我还学习了如何将引导添加到应用程序的教程,但我被卡住了,因为它要求您使用TOUCH命令,而我正在运行的Windows没有与TOUCH命令等效的命令。说明如下:

在命令中键入以下内容:

touch app/assets/stylesheets/bootstrap_and_overrides.css.scss
然后,它告诉您打开它创建的文件并键入以下内容:

@import "bootstrap";
body { padding-top: 60px; }
@import "bootstrap-responsive";
我只是从一个空文本文件手动创建了该文件,然后按照其余的说明进行操作。如果您感到好奇,这里有一个指向说明的链接: 我得到了以下错误:

显示C:/Sites/railsbridgejan/suggestoron/app/views/layouts/application.html.erb,其中第7行出现:找不到文件“bootstrap”(在C:/Sites/railsbridgejan/suggestoron/app/assets/stylesheets/application.css:15中)

这是第7行所说的

“全部”%>
另外,我不确定要下载哪个引导程序,所以我只下载了这三个引导程序。我必须将这些文件移动到特定的位置吗?在教程中,它得到了gem“bootstrap sass”

编辑
Omar的解决方案有效,但我认为由于没有安装node.js,我遇到了另一个问题。以下是我的新错误:

显示C:/Sites/railsbridgejan/suggestoron/app/views/layouts/application.html.erb,其中第7行出现:

“…陷阱链轮”后的CSS无效:应为选择器或at规则,为“@import”bootst…” (C:/Sites/railsbridgejan/suggestoron/app/assets/stylesheets/application.scss:21)
提取的源代码(第0行附近):

您好,我将尝试在Windows上共享我当前的rails应用程序:

首先,我不知道你为什么要使用触摸命令,我不记得在我的应用程序中使用过它。我将尝试向您展示我的一些重要文件包含的内容,以便您可以指导自己并尝试找到解决此问题的方法

  #Gemfile
    gem 'bootstrap-sass', '~> 3.3.1.0'



    #app/stylesheets/application.css.scss
    /*
 * This is a manifest file that'll be compiled into application.css, which will include all the files
 * listed below.
 *
 * Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets,
 * or vendor/assets/stylesheets of plugins, if any, can be referenced here using a relative path.
 *
 * You're free to add application-wide styles to this file and they'll appear at the bottom of the
 * compiled file so the styles you add here take precedence over styles defined in any styles
 * defined in the other CSS/SCSS files in this directory. It is generally better to create a new
 * file per style scope.
 *
 *= require 'masonry/transitions'
 *= require 'masonry/infinitescroll'
 *= require_tree .
 *= require social-share-button
 *= require jquery.tagsinput
 *= require jquery.minicolors
 *= require font-awesome
 *= require_self
 */


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

    #.../layout/application.html.haml
    #this goes right below %head
    = stylesheet_link_tag    'application', media: 'all', 'data-turbolinks-track' => true
    = javascript_include_tag 'application', 'data-turbolinks-track' => true

    #app/javascripts/application.js
    //= require bootstrap-sprockets

我最近遇到了这个问题,并尝试按照以下说明解决了它:

1-在/assets/stylesheet中创建一个新文件,并命名为custom.css.sass

2-将此部分添加到custom.css.sass文件的顶部

@import“引导链轮”;
@导入“引导”

3-保存它

你可以走了

问题出在我的custom.css.scss文件的扩展名中。使用SCS是错误的,当我把它改为sass时,一切都解决了


祝你好运

感谢您的回复,但我仍然收到一个错误:Sprocket::FileNotFound in Topics#index show C:/Sites/railsbridgejan/Suggestoron/app/views/layouts/application.html.erb,其中第7行出现:找不到文件“bootstrap”(在C:/Sites/railsbridgejan/Suggestoron/app/assets/stylesheets/application.css:18中)提取的源代码(在第0行附近):因此,我在我的样式表/application.css文件中看到它后面没有.sass。这可能与我的问题有关吗?我尝试过向它添加.sass,但它只是将它放在application.css.cssAlso的下面,在样式表/application.css文件中我应该在哪里添加@import等…?我只是将它放在*=req上面uire_树您需要在require_树之后添加它。在顶部的注释部分之外。我拥有的扩展不是“sass”,而是“scss”。我可以将其移动并将我的样式表/application.css更改为sass文件。它显示与我的第一条评论相同的消息。这是我的应用程序文件底部的外观(在符号处)导入“引导链轮”(在符号处)导入“引导”*=require\u tree.*=require\u self*=require bootstrap*/我在谷歌搜索中发现了这个问题,我想这只是导入引导链轮后缺少的分号
  #Gemfile
    gem 'bootstrap-sass', '~> 3.3.1.0'



    #app/stylesheets/application.css.scss
    /*
 * This is a manifest file that'll be compiled into application.css, which will include all the files
 * listed below.
 *
 * Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets,
 * or vendor/assets/stylesheets of plugins, if any, can be referenced here using a relative path.
 *
 * You're free to add application-wide styles to this file and they'll appear at the bottom of the
 * compiled file so the styles you add here take precedence over styles defined in any styles
 * defined in the other CSS/SCSS files in this directory. It is generally better to create a new
 * file per style scope.
 *
 *= require 'masonry/transitions'
 *= require 'masonry/infinitescroll'
 *= require_tree .
 *= require social-share-button
 *= require jquery.tagsinput
 *= require jquery.minicolors
 *= require font-awesome
 *= require_self
 */


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

    #.../layout/application.html.haml
    #this goes right below %head
    = stylesheet_link_tag    'application', media: 'all', 'data-turbolinks-track' => true
    = javascript_include_tag 'application', 'data-turbolinks-track' => true

    #app/javascripts/application.js
    //= require bootstrap-sprockets