我觉得奇怪,为什么风格没有加载,
所以我故意在application.css.scss
,
并且precompile
并加载页面并没有给我任何错误。
我认为不能加载和编译application.css.scss
文件。
不幸的是,似乎没有。
@i2dmport "compass";
/*
* 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 top of the
* compiled file, but it's generally better to create a new file per style scope.
*
*= require_self
*= require jquery.fileupload-ui
*= require dropzone/dropzone
*= require dropzone/basicdew
*= require_tree .
*/
@import "layout";
config.autoload_paths += %W(#{Rails.root}/app/pdfs)
config.autoload_paths += %W(#{config.root}/lib/)
# Set Time.zone default to the specified zone and make Active Record auto-convert to this zone.
# Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC.
# config.time_zone = 'Central Time (US & Canada)'
config.assets.paths << "#{Rails.root}/vendor/themes"
source 'http://rubygems.org'
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '4.1.5'
# Use postgresql as the database for Active Record
gem 'pg', '~> 0.17.1'
# Use SCSS for stylesheets
gem 'sass-rails', '~> 4.0.0'
# 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
# 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', '~> 1.2'
group :doc do
# bundle exec rake doc:rails generates the API under doc/api.
gem 'sdoc', require: false
end
gem "bootstrap-sass", "~> 3.1.1"
gem "compass-rails"
gem "therubyracer"
gem "execjs"
gem "hirb-unicode"
gem "devise", "~> 3.3.0"
gem "devise_ldap_authenticatable", "~> 0.6.1"
gem "net-ldap"
gem "will_paginate", "~> 3.0"
gem "rspec"
gem "awesome_print", require: "ap"
gem "tinymce-rails"
gem "simple_form"
gem "haml-rails"
gem "taps"
gem "analytics-ruby"
gem "bcrypt-ruby"
gem "bourbon"
gem 'cancancan', '~> 1.8'
gem "sunspot_rails"
gem "sunspot_solr"
gem "simple-navigation"
gem "simple-navigation-bootstrap"
#fast command
gem "spring", group: :development
#Handy tools for active record
gem "squeel", "~> 1.2.1" # Last officially released gem
# gem "squeel", :git => "git://github.com/activerecord-hackery/squeel.git" # Track git repo
gem 'prawn'
gem 'rb-readline', "~> 0.5.0.pre.1"
gem 'chartkick'
gem 'rails-erd', :group => :development
gem 'quiet_assets', group: :development
gem 'curb'
gem 'rest_client'
# only for assets not required in production mode
gem 'jquery-rails'
gem 'jquery-ui-rails'
gem 'jquery.fileupload-rails', "~> 1.10.0"
gem 'twitter-bootstrap-rails'
group :development do
gem "faker"
gem "rspec-rails"
gem "guard-rspec"
gem "pry"
gem "pry-remote"
gem "pry-nav"
gem 'pry-rescue'
gem 'pry-stack_explorer'
end
gem "paperclip", "~> 4.1"
gem 'dropzonejs-rails'
!!!
%html
%head
= stylesheet_link_tag "application", media: "all", "data-turbolinks-track" => true
= stylesheet_link_tag params[:controller]
= javascript_include_tag "application", "data-turbolinks-track" => true
= javascript_include_tag params[:controller], "data-turbolinks-track" => true
答案 0 :(得分:1)
我有同样的问题并且让我发疯。我有一个app / assets / stylesheets / mycustom_stylesheet.css.scss,其中的样式在开发中加载得很好但是当我在heroku上部署到生产时,我的样式都没有出现。我通过将custom.css文件放在我的vendor / assets / stylesheets目录中并使用以下内容解决了这个问题:
/*
*= require mycustom_stylesheet
*/
我还将此行添加到我的initializers / assets.rb文件中,但我不确定是否有必要。
Rails.application.config.assets.precompile += %w( mycustom_stylesheet.css )
答案 1 :(得分:0)
您的“/ vendor / themes /”或“/ lib”文件夹中是否有“application.css”文件?
如果从application.rb文件中删除此行“config.assets.paths&lt;&lt;”#{Rails.root} / vendor / themes“会发生什么?
答案 2 :(得分:0)
尝试在命令
下运行RAILS_ENV=production rake assets:precompile
或
RAILS_ENV=development rake assets:precompile
答案 3 :(得分:0)
今天我遇到了类似的问题,application.css.scss
中的更改未在页面样式中更新。后来我发现这是因为我的.scss文件中出现错误,ul
拼错为u1
。修复错误后,样式最终会在页面刷新时更新,无需重新启动rails服务器。