gpt4 book ai didi

ruby-on-rails-4 - Bootstrap Rails 4 sass 布局不工作

转载 作者:行者123 更新时间:2023-12-04 07:05:00 25 4
gpt4 key购买 nike

我正在使用以下内容:

Rails 4.1.0

ruby 2.1.1p76 (2014-02-24 revision 45161) [x86_64-linux]

rvm 1.25.25 (stable) by Wayne E. Seguin , Michal Papis [https://rvm.io/]

我的 gem 文件:

source 'https://rubygems.org'


# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '4.1.0'
# Use sqlite3 as the database for Active Record
gem 'sqlite3'
# Use SCSS for stylesheets
gem 'sass-rails', '~> 4.0.3'
gem 'bootstrap-sass-extras'


# Use Uglifier as compressor for JavaScript assets
gem 'uglifier', '>= 1.3.0'
# Use CoffeeScript for .js.coffee assets and views
gem 'coffee-rails', '~> 4.0.0'
# See https://github.com/sstephenson/execjs#readme for more supported runtimes
# gem 'therubyracer', platforms: :ruby

# Use jquery as the JavaScript library
gem 'jquery-rails'
# Turbolinks makes following links in your web application faster. Read more: https://github.com/rails/turbolinks
gem 'turbolinks'
# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
gem 'jbuilder', '~> 2.0'
# bundle exec rake doc:rails generates the API under doc/api.
gem 'sdoc', '~> 0.4.0', group: :doc

# Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring
gem 'spring', group: :development

# Use ActiveModel has_secure_password
# gem 'bcrypt', '~> 3.1.7'

# Use unicorn as the app server
# gem 'unicorn'

# Use Capistrano for deployment
# gem 'capistrano-rails', group: :development

# Use debugger
# gem 'debugger', group: [:development, :test]

并且我完成了以下任务以通过我的 railsapp 实现 bootstrap-sass-fluid 布局:

bundle install

rails g bootstrap:install

rails g bootstrap:layout application fluid

rails g scaffold Post title:string description:text

rake db:migrate

rails g bootstrap:themed Posts

我的 rails 应用程序下的 assests 文件夹中有这些文件:

/home/pallavsharma/Workspace/testapp/app/assets/stylesheets/application.css

/home/pallavsharma/Workspace/testapp/app/assets/stylesheets/posts.css.scss

/home/pallavsharma/Workspace/testapp/app/assets/stylesheets/scaffolds.css.scss

但我的应用程序中仍然没有我的 Bootstrap 布局

我的 application.css 文件内容:

/*

  • 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.

    *

Blockquote * 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_tree .

    *= require_self

    */

enter image description here

还有什么需要说的请说。

最佳答案

application.css.scss 应该是:

/*
*= require bootstrap
*= require_tree .
*= require_self
*/

还需要在gemfile中提及这个gem

 gem 'bootstrap-sass', '~> 3.1.1'

然后

bundle install

而且有效。

关于ruby-on-rails-4 - Bootstrap Rails 4 sass 布局不工作,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23510940/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com