我最近为我的网站购买了一个新主题,我想在application.css.sass
中添加新文件:
@import "custom.css.sass"
我收到了这个错误:
Invalid CSS after "#ffffff": expected expression (e.g. 1px, bold), was ";"
(in development/myapp/app/assets/stylesheets/application.css.sass:142)
css文件在html文件中运行得很好,我该怎么办?
更新
一些css arround 142:
.notification_error,
.notification_ok {
background: #ffffff;
border:#e6e6e6 1px solid;
}
.notification_error:after,
.notification_ok:after {
background: #e6e6e6;
}
.shortcode_tab_item_title {
border:#e6e6e6 1px solid;
}
如果我导入: @import" custom.css"
一切正常,但如果我只使用.css
我的资源未加载到heroku上。
更新II:这是我的Gemfile
source 'https://rubygems.org'
ruby '2.0.0'
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '4.1.1'
# Use postgres
gem 'pg', '0.12.2'
# soft deleted
gem "paranoia", "~> 2.0"
# 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
# background jobs
gem 'delayed_job_active_record'
# rack options
gem 'rack-rewrite'
# static pages
gem 'high_voltage', '~> 2.2.1'
#haml templates
gem 'haml-rails', '~> 0.4'
#youtube like ids
gem 'hashids'
#better form
gem 'simple_form'
#password digest stuff
gem 'bcrypt-ruby', '3.1.2', :require => 'bcrypt'
#aws stuff
gem 'aws-s3', :require => 'aws/s3'
gem 'aws-sdk'
gem 'fog'
gem 'carrierwave'
#assets
gem 'sprockets-rails', '~> 2.0.0', :require => 'sprockets/railtie'
gem 'asset_sync'
gem 'sass-rails', '~> 4.0.2'
gem 'compass-rails', '1.1.2'
gem 'coffee-rails', '~> 4.0.0'
gem 'uglifier', '>= 1.3.0'
group :development do
gem 'annotate'
gem 'quiet_assets'
gem 'foreman'
gem 'rails_best_practices', '~> 1.14.0'
gem 'better_errors'
gem 'binding_of_caller'
gem 'guard-livereload', require: false
gem 'pry-byebug'
gem 'spring'
end
group :development, :test do
gem 'rspec-rails', '~> 2.13.0'
gem 'guard-rspec', '2.5.3'
gem 'guard-spork', :github => 'guard/guard-spork'
gem 'spork', '0.9.2'
gem 'thin'
gem 'launchy'
gem 'awesome_print'
gem 'sql_queries_count'
gem 'debugger'
gem 'oink'
end
这是我的Gemfile,以防我在这里做错了,因为有些东西是从rails 4中取出的
答案 0 :(得分:2)
您尝试导入的文件是css,而不是sass。因此,请将文件重命名为custom.css.scss
。此外,您不必在@import
指令中编写文件扩展名,因此请将其更改为@import "custom";
。不要忘记行尾的分号,顺便说一句。
答案 1 :(得分:1)
问题只是.scss
和.sass
语法之间的差异:
#scss
.notification_ok {
background: #ffffff;
border:#e6e6e6 1px solid;
}
#sass
.notification_ok
background: #fff
border: #e6e6e6 1px solid
如另一个答案所述,只需将名称从custom.css.sass
更改为custom.css.scss
-
此外,您还希望使用以下内容:
@import "custom"