我正在使用Devise学习Rails并遵循本教程:https://www.sitepoint.com/devise-authentication-in-depth/
在此期间我使用Bootstrap-Sass进行样式设置。我有一个奇怪的问题,在应用程序位于Heroku上的生产中加载样式,但在我的计算机上开发时,我只是得到了空白,没有样式的形式。我觉得好像我改变了(或没有改变)某些东西的设置或版本,但我不确定是什么。我不确定为什么某些东西在Heroku上可以正常工作但在我自己的电脑上却是平稳的。
我正在使用Rails 5.下面是我的Gemfile的副本,这有帮助。我会根据需要提供其他文件/信息。
source 'https://rubygems.org'
#ruby version
ruby "2.3.1"
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '~> 5.0.0'
# Use postgresql as the database for Active Record
gem 'pg', '~> 0.18'
# Use Puma as the app server
gem 'puma', '~> 3.0'
# Use SCSS for stylesheets
gem 'sass-rails', '~> 5.0'
# Use Uglifier as compressor for JavaScript assets
gem 'uglifier', '>= 1.3.0'
# Use CoffeeScript for .coffee assets and views
gem 'coffee-rails', '~> 4.2'
# See https://github.com/rails/execjs#readme for more supported runtimes
# gem 'therubyracer', platforms: :ruby
# Use jquery as the JavaScript library
gem 'jquery-rails'
# Turbolinks makes navigating your web application faster. Read more: https://github.com/turbolinks/turbolinks
gem 'turbolinks', '~> 5'
# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
gem 'jbuilder', '~> 2.5'
# Use Redis adapter to run Action Cable in production
# gem 'redis', '~> 3.0'
# Use ActiveModel has_secure_password
# gem 'bcrypt', '~> 3.1.7'
# Use Capistrano for deployment
# gem 'capistrano-rails', group: :development
# Use Bootstrap for styling
gem 'bootstrap-sass'
# Use Devise for authentication
gem 'devise'
# Fix issues with Bootstrap dropdown menu, Javascript, and Turbolinks
gem 'jquery-turbolinks'
# Perform email sending in background
#gem 'delayed_job_active_record'
group :development, :test do
# Call 'byebug' anywhere in the code to stop execution and get a debugger console
gem 'byebug', platform: :mri
end
group :development do
# Access an IRB console on exception pages or by using <%= console %> anywhere in the code.
gem 'web-console'
gem 'listen', '~> 3.0.5'
# Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring
gem 'spring'
gem 'spring-watcher-listen', '~> 2.0.0'
end
group :test do
gem 'rails-controller-testing', '0.1.1'
gem 'minitest-reporters', '1.1.9'
gem 'guard', '2.13.0'
gem 'guard-minitest', '2.4.4'
end
# Windows does not include zoneinfo files, so bundle the tzinfo-data gem
gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby]
答案 0 :(得分:0)
我设法用这个解决了我自己的问题(它进入了我不断增长的一堆愚蠢的错误)。而不是按照指示将我的application.css文件重命名为.scss,在我的无限智慧中,我创建了一个新的.scss文件并保留了我的旧.css文件。删除它让Bootstrap样式自由运行。我不确定Heroku为什么没有那些文件存在问题,我想它只是足够聪明才能理解我的愚蠢错误。
我应该在某些时候使用新的Bootstrap 4,但是现在我喜欢我在使用的教程中找到的样式。请继续关注更多幽默错误。