阅读背景:

如何解决bootstrap未应用于cloud9 ide开发的rails应用程序?

来源:互联网 

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

我是使用Ruby on Rails开发应用程序的初学者,我目前正在注册并使用Cloud9作为我的开发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.

我已经毫不费力地创建了我的第一个Rails项目,并且我正在学习如何创建应用bootstrap的Rails网站的教程。

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.

我已经安装了必要的gems bootstrap-sass和autoprefixer-rails,将我的application.css重命名为application.css.scss,添加了@import“bootstrap-sprockets”和@import“bootstrap”,添加了// = require bootstrap-sprockets到application.js并添加了一个直接从bootstrap主页复制的导航栏。

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

我一直关注的教程是这个youtube教程视频:

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.

问题是,在保存所有更改后,甚至在重新启动我的rails服务器之后,似乎永远不会应用bootstrap,我无法在我的应用程序中使用它。对此问题的任何见解可能有助于我解决它。我一直在尝试搜索谷歌,但似乎这是一个罕见的情况,所以我找不到任何好的信息来解决这个问题。

1 个解决方案

#1


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.

您的问题有几种可能性,但是,我们没有足够的信息来帮助您。有用的信息将是:Rails版本,ruby版本,快速查看您的gem文件等。

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

对于过渡期,只需在布局中的application.html.erb文件中使用这些CDN。

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

CSS:

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

JS:

Things to definitely check:

事情要肯定检查:

  • Gemfile syntax (https://bundler.io/gemfile.html)
  • Gemfile语法(https://bundler.io/gemfile.html)

  • Whether your config file (application.css/js files)for the asset pipeline is set-up correctly.
  • 是否正确设置了资产管道的配置文件(application.css / js文件)。

  • If you have any simple syntax issues anywhere. (I know, this is redundant.)
  • 如果你有任何简单的语法问题。 (我知道,这是多余的。)


分享到: