我正在尝试将当前主题集成到我的rails应用中。在我运行时进行整理
rake assets:precompile --trace
我收到以下错误。
** Invoke assets:precompile (first_time)
** Invoke assets:environment (first_time)
** Execute assets:environment
** Invoke environment (first_time)
** Execute environment
** Execute assets:precompile
rake aborted!
Sass::SyntaxError: Undefined variable: "$fa-css-prefix".
/home/munam/projects/infotachus/ror/nutritious_dec_28/app/assets/stylesheets/_animated.scss:4
/home/munam/.rvm/gems/ruby-2.2.3@Nutritious/gems/sass-3.4.20/lib/sass/script/tree/variable.rb:49:in `_perform'
/home/munam/.rvm/gems/ruby-2.2.3@Nutritious/gems/sass-3.4.20/lib/sass/script/tree/node.rb:50:in `perform'
/home/munam/.rvm/gems/ruby-2.2.3@Nutritious/gems/sass-3.4.20/lib/sass/script/tree/interpolation.rb:170:in `_perform'
/home/munam/.rvm/gems/ruby-2.2.3@Nutritious/gems/sass-3.4.20/lib/sass/script/tree/node.rb:50:in `perform'
/home/munam/.rvm/gems/ruby-2.2.3@Nutritious/gems/sass-3.4.20/lib/sass/tree/visitors/perform.rb:540:in `block in run_interp_no_strip'
/home/munam/.rvm/gems/ruby-2.2.3@Nutritious/gems/sass-3.4.20/lib/sass/tree/visitors/perform.rb:538:in `map'
/home/munam/.rvm/gems/ruby-2.2.3@Nutritious/gems/sass-3.4.20/lib/sass/tree/visitors/perform.rb:538:in `run_interp_no_strip'
/home/munam/.rvm/gems/ruby-2.2.3@Nutritious/gems/sass-3.4.20/lib/sass/tree/visitors/perform.rb:545:in `run_interp'
/home/munam/.rvm/gems/ruby-2.2.3@Nutritious/gems/sass-3.4.20/lib/sass/tree/visitors/perform.rb:410:in `visit_rule'
/home/munam/.rvm/gems/ruby-2.2.3@Nutritious/gems/sass-3.4.20/lib/sass/tree/visitors/base.rb:36:in `visit'
/home/munam/.rvm/gems/ruby-2.2.3@Nutritious/gems/sass-3.4.20/lib/sass/tree/visitors/perform.rb:158:in `block in visit'
/home/munam/.rvm/gems/ruby-2.2.3@Nutritious/gems/sass-3.4.20/lib/sass/stack.rb:79:in `block in with_base'
/home/munam/.rvm/gems/ruby-2.2.3@Nutritious/gems/sass-3.4.20/lib/sass/stack.rb:115:in `with_frame'
/home/munam/.rvm/gems/ruby-2.2.3@Nutritious/gems/sass-3.4.20/lib/sass/stack.rb:79:in `with_base'
/home/munam/.rvm/gems/ruby-2.2.3@Nutritious/gems/sass-3.4.20/lib/sass/tree/visitors/perform.rb:158:in `visit'
/home/munam/.rvm/gems/ruby-2.2.3@Nutritious/gems/sass-3.4.20/lib/sass/tree/visitors/base.rb:52:in `block in visit_children'
/home/munam/.rvm/gems/ruby-2.2.3@Nutritious/gems/sass-3.4.20/lib/sass/tree/visitors/base.rb:52:in `map'
/home/munam/.rvm/gems/ruby-2.2.3@Nutritious/gems/sass-3.4.20/lib/sass/tree/visitors/base.rb:52:in `visit_children'
/home/munam/.rvm/gems/ruby-2.2.3@Nutritious/gems/sass-3.4.20/lib/sass/tree/visitors/perform.rb:167:in `block in visit_children'
/home/munam/.rvm/gems/ruby-2.2.3@Nutritious/gems/sass-3.4.20/lib/sass/tree/visitors/perform.rb:179:in `with_environment'
/home/munam/.rvm/gems/ruby-2.2.3@Nutritious/gems/sass-3.4.20/lib/sass/tree/visitors/perform.rb:166:in `visit_children'
/home/munam/.rvm/gems/ruby-2.2.3@Nutritious/gems/sass-3.4.20/lib/sass/tree/visitors/base.rb:36:in `block in visit'
/home/munam/.rvm/gems/ruby-2.2.3@Nutritious/gems/sass-3.4.20/lib/sass/tree/visitors/perform.rb:186:in `visit_root'
/home/munam/.rvm/gems/ruby-2.2.3@Nutritious/gems/sass-3.4.20/lib/sass/tree/visitors/base.rb:36:in `visit'
/home/munam/.rvm/gems/ruby-2.2.3@Nutritious/gems/sass-3.4.20/lib/sass/tree/visitors/perform.rb:157:in `visit'
/home/munam/.rvm/gems/ruby-2.2.3@Nutritious/gems/sass-3.4.20/lib/sass/tree/visitors/perform.rb:8:in `visit'
/home/munam/.rvm/gems/ruby-2.2.3@Nutritious/gems/sass-3.4.20/lib/sass/tree/root_node.rb:36:in `css_tree'
/home/munam/.rvm/gems/ruby-2.2.3@Nutritious/gems/sass-3.4.20/lib/sass/tree/root_node.rb:20:in `render'
/home/munam/.rvm/gems/ruby-2.2.3@Nutritious/gems/sass-3.4.20/lib/sass/engine.rb:278:in `render'
/home/munam/.rvm/gems/ruby-2.2.3@Nutritious/gems/sprockets-3.5.2/lib/sprockets/sass_processor.rb:74:in `block in call'
/home/munam/.rvm/gems/ruby-2.2.3@Nutritious/gems/sprockets-3.5.2/lib/sprockets/utils.rb:154:in `module_include'
/home/munam/.rvm/gems/ruby-2.2.3@Nutritious/gems/sprockets-3.5.2/lib/sprockets/sass_processor.rb:73:in `call'
/home/munam/.rvm/gems/ruby-2.2.3@Nutritious/gems/sprockets-3.5.2/lib/sprockets/sass_processor.rb:30:in `call'
/home/munam/.rvm/gems/ruby-2.2.3@Nutritious/gems/sprockets-3.5.2/lib/sprockets/processor_utils.rb:75:in `call_processor'
/home/munam/.rvm/gems/ruby-2.2.3@Nutritious/gems/sprockets-3.5.2/lib/sprockets/processor_utils.rb:57:in `block in call_processors'
/home/munam/.rvm/gems/ruby-2.2.3@Nutritious/gems/sprockets-3.5.2/lib/sprockets/processor_utils.rb:56:in `reverse_each'
/home/munam/.rvm/gems/ruby-2.2.3@Nutritious/gems/sprockets-3.5.2/lib/sprockets/processor_utils.rb:56:in `call_processors'
/home/munam/.rvm/gems/ruby-2.2.3@Nutritious/gems/sprockets-3.5.2/lib/sprockets/loader.rb:134:in `load_from_unloaded'
/home/munam/.rvm/gems/ruby-2.2.3@Nutritious/gems/sprockets-3.5.2/lib/sprockets/loader.rb:60:in `block in load'
/home/munam/.rvm/gems/ruby-2.2.3@Nutritious/gems/sprockets-3.5.2/lib/sprockets/loader.rb:318:in `fetch_asset_from_dependency_cache'
/home/munam/.rvm/gems/ruby-2.2.3@Nutritious/gems/sprockets-3.5.2/lib/sprockets/loader.rb:44:in `load'
/home/munam/.rvm/gems/ruby-2.2.3@Nutritious/gems/sprockets-3.5.2/lib/sprockets/cached_environment.rb:20:in `block in initialize'
/home/munam/.rvm/gems/ruby-2.2.3@Nutritious/gems/sprockets-3.5.2/lib/sprockets/cached_environment.rb:47:in `yield'
/home/munam/.rvm/gems/ruby-2.2.3@Nutritious/gems/sprockets-3.5.2/lib/sprockets/cached_environment.rb:47:in `load'
/home/munam/.rvm/gems/ruby-2.2.3@Nutritious/gems/sprockets-3.5.2/lib/sprockets/bundle.rb:23:in `block in call'
/home/munam/.rvm/gems/ruby-2.2.3@Nutritious/gems/sprockets-3.5.2/lib/sprockets/utils.rb:183:in `dfs'
/home/munam/.rvm/gems/ruby-2.2.3@Nutritious/gems/sprockets-3.5.2/lib/sprockets/bundle.rb:24:in `call'
/home/munam/.rvm/gems/ruby-2.2.3@Nutritious/gems/sprockets-3.5.2/lib/sprockets/processor_utils.rb:75:in `call_processor'
/home/munam/.rvm/gems/ruby-2.2.3@Nutritious/gems/sprockets-3.5.2/lib/sprockets/processor_utils.rb:57:in `block in call_processors'
/home/munam/.rvm/gems/ruby-2.2.3@Nutritious/gems/sprockets-3.5.2/lib/sprockets/processor_utils.rb:56:in `reverse_each'
/home/munam/.rvm/gems/ruby-2.2.3@Nutritious/gems/sprockets-3.5.2/lib/sprockets/processor_utils.rb:56:in `call_processors'
/home/munam/.rvm/gems/ruby-2.2.3@Nutritious/gems/sprockets-3.5.2/lib/sprockets/loader.rb:134:in `load_from_unloaded'
/home/munam/.rvm/gems/ruby-2.2.3@Nutritious/gems/sprockets-3.5.2/lib/sprockets/loader.rb:60:in `block in load'
/home/munam/.rvm/gems/ruby-2.2.3@Nutritious/gems/sprockets-3.5.2/lib/sprockets/loader.rb:318:in `fetch_asset_from_dependency_cache'
/home/munam/.rvm/gems/ruby-2.2.3@Nutritious/gems/sprockets-3.5.2/lib/sprockets/loader.rb:44:in `load'
/home/munam/.rvm/gems/ruby-2.2.3@Nutritious/gems/sprockets-3.5.2/lib/sprockets/cached_environment.rb:20:in `block in initialize'
/home/munam/.rvm/gems/ruby-2.2.3@Nutritious/gems/sprockets-3.5.2/lib/sprockets/cached_environment.rb:47:in `yield'
/home/munam/.rvm/gems/ruby-2.2.3@Nutritious/gems/sprockets-3.5.2/lib/sprockets/cached_environment.rb:47:in `load'
/home/munam/.rvm/gems/ruby-2.2.3@Nutritious/gems/sprockets-3.5.2/lib/sprockets/base.rb:66:in `find_asset'
/home/munam/.rvm/gems/ruby-2.2.3@Nutritious/gems/sprockets-3.5.2/lib/sprockets/base.rb:73:in `find_all_linked_assets'
/home/munam/.rvm/gems/ruby-2.2.3@Nutritious/gems/sprockets-3.5.2/lib/sprockets/manifest.rb:142:in `block in find'
/home/munam/.rvm/gems/ruby-2.2.3@Nutritious/gems/sprockets-3.5.2/lib/sprockets/legacy.rb:114:in `block (2 levels) in logical_paths'
/home/munam/.rvm/gems/ruby-2.2.3@Nutritious/gems/sprockets-3.5.2/lib/sprockets/path_utils.rb:225:in `block in stat_tree'
/home/munam/.rvm/gems/ruby-2.2.3@Nutritious/gems/sprockets-3.5.2/lib/sprockets/path_utils.rb:209:in `block in stat_directory'
/home/munam/.rvm/gems/ruby-2.2.3@Nutritious/gems/sprockets-3.5.2/lib/sprockets/path_utils.rb:206:in `each'
/home/munam/.rvm/gems/ruby-2.2.3@Nutritious/gems/sprockets-3.5.2/lib/sprockets/path_utils.rb:206:in `stat_directory'
/home/munam/.rvm/gems/ruby-2.2.3@Nutritious/gems/sprockets-3.5.2/lib/sprockets/path_utils.rb:224:in `stat_tree'
/home/munam/.rvm/gems/ruby-2.2.3@Nutritious/gems/sprockets-3.5.2/lib/sprockets/legacy.rb:105:in `each'
/home/munam/.rvm/gems/ruby-2.2.3@Nutritious/gems/sprockets-3.5.2/lib/sprockets/legacy.rb:105:in `block in logical_paths'
/home/munam/.rvm/gems/ruby-2.2.3@Nutritious/gems/sprockets-3.5.2/lib/sprockets/legacy.rb:104:in `each'
/home/munam/.rvm/gems/ruby-2.2.3@Nutritious/gems/sprockets-3.5.2/lib/sprockets/legacy.rb:104:in `logical_paths'
/home/munam/.rvm/gems/ruby-2.2.3@Nutritious/gems/sprockets-3.5.2/lib/sprockets/manifest.rb:140:in `find'
/home/munam/.rvm/gems/ruby-2.2.3@Nutritious/gems/sprockets-3.5.2/lib/sprockets/manifest.rb:168:in `compile'
/home/munam/.rvm/gems/ruby-2.2.3@Nutritious/gems/sprockets-rails-3.0.0/lib/sprockets/rails/task.rb:68:in `block (3 levels) in define'
/home/munam/.rvm/gems/ruby-2.2.3@Nutritious/gems/sprockets-3.5.2/lib/rake/sprocketstask.rb:147:in `with_logger'
/home/munam/.rvm/gems/ruby-2.2.3@Nutritious/gems/sprockets-rails-3.0.0/lib/sprockets/rails/task.rb:67:in `block (2 levels) in define'
/home/munam/.rvm/rubies/ruby-2.2.3/lib/ruby/2.2.0/rake/task.rb:240:in `call'
/home/munam/.rvm/rubies/ruby-2.2.3/lib/ruby/2.2.0/rake/task.rb:240:in `block in execute'
/home/munam/.rvm/rubies/ruby-2.2.3/lib/ruby/2.2.0/rake/task.rb:235:in `each'
/home/munam/.rvm/rubies/ruby-2.2.3/lib/ruby/2.2.0/rake/task.rb:235:in `execute'
/home/munam/.rvm/rubies/ruby-2.2.3/lib/ruby/2.2.0/rake/task.rb:179:in `block in invoke_with_call_chain'
/home/munam/.rvm/rubies/ruby-2.2.3/lib/ruby/2.2.0/monitor.rb:211:in `mon_synchronize'
/home/munam/.rvm/rubies/ruby-2.2.3/lib/ruby/2.2.0/rake/task.rb:172:in `invoke_with_call_chain'
/home/munam/.rvm/rubies/ruby-2.2.3/lib/ruby/2.2.0/rake/task.rb:165:in `invoke'
/home/munam/.rvm/rubies/ruby-2.2.3/lib/ruby/2.2.0/rake/application.rb:150:in `invoke_task'
/home/munam/.rvm/rubies/ruby-2.2.3/lib/ruby/2.2.0/rake/application.rb:106:in `block (2 levels) in top_level'
/home/munam/.rvm/rubies/ruby-2.2.3/lib/ruby/2.2.0/rake/application.rb:106:in `each'
/home/munam/.rvm/rubies/ruby-2.2.3/lib/ruby/2.2.0/rake/application.rb:106:in `block in top_level'
/home/munam/.rvm/rubies/ruby-2.2.3/lib/ruby/2.2.0/rake/application.rb:115:in `run_with_threads'
/home/munam/.rvm/rubies/ruby-2.2.3/lib/ruby/2.2.0/rake/application.rb:100:in `top_level'
/home/munam/.rvm/rubies/ruby-2.2.3/lib/ruby/2.2.0/rake/application.rb:78:in `block in run'
/home/munam/.rvm/rubies/ruby-2.2.3/lib/ruby/2.2.0/rake/application.rb:176:in `standard_exception_handling'
/home/munam/.rvm/rubies/ruby-2.2.3/lib/ruby/2.2.0/rake/application.rb:75:in `run'
/home/munam/.rvm/rubies/ruby-2.2.3/bin/rake:33:in `<main>'
我的主题中有三个文件夹
当集成到我的应用程序时,我已将这些文件夹的文件合并到一个文件夹中。
应用程序/资产/样式表
以下是我宝石文件中的宝石。
source 'https://rubygems.org'
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '4.2.5'
# Use sqlite3 as the database for Active Record
gem 'pg'
# Use SCSS for stylesheets
# Use Uglifier as compressor for JavaScript assets
gem 'uglifier', '>= 1.3.0'
# Use CoffeeScript for .coffee assets and views
gem 'coffee-rails', '~> 4.1.0'
# 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 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
# 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
group :assets do
gem 'sass-rails', '~> 5.0'
gem 'font-awesome-rails'
gem 'font-awesome-sass'
gem 'font-awesome-sass-rails'
gem 'twitter-bootstrap-rails', :git => 'git://github.com/seyhunak/twitter-bootstrap-rails.git'
end
group :development, :test do
# Call 'byebug' anywhere in the code to stop execution and get a debugger console
gem 'byebug'
gem 'dotenv-rails'
end
group :development do
# Access an IRB console on exception pages or by using <%= console %> in views
gem 'web-console', '~> 2.0'
gem 'better_errors'
gem 'binding_of_caller'
# Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring
gem 'spring'
end
gem 'devise'
gem 'amazon-ecs'
gem 'sucker'
gem 'vacuum'
gem 'actionpack-xml_parser'
我的application.css
中只有这两行 *
*= require_tree .
*= require_self
*/
和我的config / initializers / assets.rb中的这一行
Rails.application.config.assets.precompile += [/.*\.png/,/.*\.ico/,/.*\.jpg/,/.*\.js/,/.*\.scss/]
我已经尝试了stackoverflow和github上的所有线程,但在我的情况下似乎没有任何工作。寻找什么仍然不明确。任何帮助都会非常棒。非常感谢!
答案 0 :(得分:2)
Gemfile
:
font-awesome
次引用
gem 'font-awesome-rails', '~> 4.5'
-
至于错误,这意味着您在声明变量之前尝试调用变量。
因为这是font-awesome
错误,我推测它是因为您在Gemfile
中包含了3个不同的宝石。
除了上面提到的宝石外,摆脱所有宝石。
您还需要在CSS管道中包含相关的font-awesome
文件:
#app/assets/stylesheets/application.css
*
*= require font-awesome
*= require_tree .
*= require_self
*/
答案 1 :(得分:0)
如果您使用scss而不是css,只需在config / application.rb中添加这些行。
config.assets.precompile << %w( *.scss *.js )