这是我的application.scss
文件:
@import "variables";
@import "bootstrap-sprockets";
@import "bootstrap-overrides";
@import "bootstrap";
@import "fancybox/jquery.fancybox";
@import "fancybox/jquery.fancybox-thumbs";
@import "fancybox/jquery.fancybox-buttons";
@import "font-awesome";
@import "theme";
@import "magnific-popup";
@import "jquery.gritter";
@import "summernote";
@import "style";
@import "media";
我已尝试命名"变量"文件_variables.scss
和variables.scss
但都不起作用,因为当我预编译时,似乎所有内容都按字母顺序预编译。因此,只要media.scss
开始预编译,我就会收到此错误:
Sass::SyntaxError: Undefined variable: "$white".
/Users/Trevor/Work/SplitRock/app/assets/stylesheets/_media.scss:3
/Users/Trevor/.rvm/gems/ruby-2.2.2/gems/sass-3.4.13/lib/sass/script/tree/variable.rb:49:in `_perform'
/Users/Trevor/.rvm/gems/ruby-2.2.2/gems/sass-3.4.13/lib/sass/script/tree/node.rb:50:in `perform'
/Users/Trevor/.rvm/gems/ruby-2.2.2/gems/sass-3.4.13/lib/sass/tree/visitors/perform.rb:394:in `visit_prop'
/Users/Trevor/.rvm/gems/ruby-2.2.2/gems/sass-3.4.13/lib/sass/tree/visitors/base.rb:36:in `visit'
/Users/Trevor/.rvm/gems/ruby-2.2.2/gems/sass-3.4.13/lib/sass/tree/visitors/perform.rb:158:in `block in visit'
/Users/Trevor/.rvm/gems/ruby-2.2.2/gems/sass-3.4.13/lib/sass/stack.rb:79:in `block in with_base'
/Users/Trevor/.rvm/gems/ruby-2.2.2/gems/sass-3.4.13/lib/sass/stack.rb:115:in `with_frame'
/Users/Trevor/.rvm/gems/ruby-2.2.2/gems/sass-3.4.13/lib/sass/stack.rb:79:in `with_base'
/Users/Trevor/.rvm/gems/ruby-2.2.2/gems/sass-3.4.13/lib/sass/tree/visitors/perform.rb:158:in `visit'
/Users/Trevor/.rvm/gems/ruby-2.2.2/gems/sass-3.4.13/lib/sass/tree/visitors/perform.rb:430:in `block (2 levels) in visit_rule'
/Users/Trevor/.rvm/gems/ruby-2.2.2/gems/sass-3.4.13/lib/sass/tree/visitors/perform.rb:430:in `map'
/Users/Trevor/.rvm/gems/ruby-2.2.2/gems/sass-3.4.13/lib/sass/tree/visitors/perform.rb:430:in `block in visit_rule'
/Users/Trevor/.rvm/gems/ruby-2.2.2/gems/sass-3.4.13/lib/sass/tree/visitors/perform.rb:179:in `with_environment'
/Users/Trevor/.rvm/gems/ruby-2.2.2/gems/sass-3.4.13/lib/sass/tree/visitors/perform.rb:428:in `visit_rule'
/Users/Trevor/.rvm/gems/ruby-2.2.2/gems/sass-3.4.13/lib/sass/tree/visitors/base.rb:36:in `visit'
/Users/Trevor/.rvm/gems/ruby-2.2.2/gems/sass-3.4.13/lib/sass/tree/visitors/perform.rb:158:in `block in visit'
/Users/Trevor/.rvm/gems/ruby-2.2.2/gems/sass-3.4.13/lib/sass/stack.rb:79:in `block in with_base'
/Users/Trevor/.rvm/gems/ruby-2.2.2/gems/sass-3.4.13/lib/sass/stack.rb:115:in `with_frame'
/Users/Trevor/.rvm/gems/ruby-2.2.2/gems/sass-3.4.13/lib/sass/stack.rb:79:in `with_base'
/Users/Trevor/.rvm/gems/ruby-2.2.2/gems/sass-3.4.13/lib/sass/tree/visitors/perform.rb:158:in `visit'
/Users/Trevor/.rvm/gems/ruby-2.2.2/gems/sass-3.4.13/lib/sass/tree/visitors/base.rb:52:in `block in visit_children'
/Users/Trevor/.rvm/gems/ruby-2.2.2/gems/sass-3.4.13/lib/sass/tree/visitors/base.rb:52:in `map'
/Users/Trevor/.rvm/gems/ruby-2.2.2/gems/sass-3.4.13/lib/sass/tree/visitors/base.rb:52:in `visit_children'
/Users/Trevor/.rvm/gems/ruby-2.2.2/gems/sass-3.4.13/lib/sass/tree/visitors/perform.rb:167:in `block in visit_children'
/Users/Trevor/.rvm/gems/ruby-2.2.2/gems/sass-3.4.13/lib/sass/tree/visitors/perform.rb:179:in `with_environment'
/Users/Trevor/.rvm/gems/ruby-2.2.2/gems/sass-3.4.13/lib/sass/tree/visitors/perform.rb:166:in `visit_children'
/Users/Trevor/.rvm/gems/ruby-2.2.2/gems/sass-3.4.13/lib/sass/tree/visitors/base.rb:36:in `block in visit'
/Users/Trevor/.rvm/gems/ruby-2.2.2/gems/sass-3.4.13/lib/sass/tree/visitors/perform.rb:512:in `visit_media'
/Users/Trevor/.rvm/gems/ruby-2.2.2/gems/sass-3.4.13/lib/sass/tree/visitors/base.rb:36:in `visit'
/Users/Trevor/.rvm/gems/ruby-2.2.2/gems/sass-3.4.13/lib/sass/tree/visitors/perform.rb:158:in `block in visit'
/Users/Trevor/.rvm/gems/ruby-2.2.2/gems/sass-3.4.13/lib/sass/stack.rb:79:in `block in with_base'
/Users/Trevor/.rvm/gems/ruby-2.2.2/gems/sass-3.4.13/lib/sass/stack.rb:115:in `with_frame'
/Users/Trevor/.rvm/gems/ruby-2.2.2/gems/sass-3.4.13/lib/sass/stack.rb:79:in `with_base'
/Users/Trevor/.rvm/gems/ruby-2.2.2/gems/sass-3.4.13/lib/sass/tree/visitors/perform.rb:158:in `visit'
/Users/Trevor/.rvm/gems/ruby-2.2.2/gems/sass-3.4.13/lib/sass/tree/visitors/base.rb:52:in `block in visit_children'
/Users/Trevor/.rvm/gems/ruby-2.2.2/gems/sass-3.4.13/lib/sass/tree/visitors/base.rb:52:in `map'
/Users/Trevor/.rvm/gems/ruby-2.2.2/gems/sass-3.4.13/lib/sass/tree/visitors/base.rb:52:in `visit_children'
/Users/Trevor/.rvm/gems/ruby-2.2.2/gems/sass-3.4.13/lib/sass/tree/visitors/perform.rb:167:in `block in visit_children'
/Users/Trevor/.rvm/gems/ruby-2.2.2/gems/sass-3.4.13/lib/sass/tree/visitors/perform.rb:179:in `with_environment'
/Users/Trevor/.rvm/gems/ruby-2.2.2/gems/sass-3.4.13/lib/sass/tree/visitors/perform.rb:166:in `visit_children'
/Users/Trevor/.rvm/gems/ruby-2.2.2/gems/sass-3.4.13/lib/sass/tree/visitors/base.rb:36:in `block in visit'
/Users/Trevor/.rvm/gems/ruby-2.2.2/gems/sass-3.4.13/lib/sass/tree/visitors/perform.rb:186:in `visit_root'
/Users/Trevor/.rvm/gems/ruby-2.2.2/gems/sass-3.4.13/lib/sass/tree/visitors/base.rb:36:in `visit'
/Users/Trevor/.rvm/gems/ruby-2.2.2/gems/sass-3.4.13/lib/sass/tree/visitors/perform.rb:157:in `visit'
/Users/Trevor/.rvm/gems/ruby-2.2.2/gems/sass-3.4.13/lib/sass/tree/visitors/perform.rb:8:in `visit'
/Users/Trevor/.rvm/gems/ruby-2.2.2/gems/sass-3.4.13/lib/sass/tree/root_node.rb:36:in `css_tree'
/Users/Trevor/.rvm/gems/ruby-2.2.2/gems/sass-3.4.13/lib/sass/tree/root_node.rb:20:in `render'
/Users/Trevor/.rvm/gems/ruby-2.2.2/gems/sass-3.4.13/lib/sass/engine.rb:268:in `render'
/Users/Trevor/.rvm/gems/ruby-2.2.2/gems/sass-rails-5.0.3/lib/sass/rails/template.rb:47:in `evaluate'
/Users/Trevor/.rvm/gems/ruby-2.2.2/gems/tilt-1.4.1/lib/tilt/template.rb:103:in `render'
/Users/Trevor/.rvm/gems/ruby-2.2.2/gems/sprockets-3.0.2/lib/sprockets/legacy_tilt_processor.rb:25:in `call'
/Users/Trevor/.rvm/gems/ruby-2.2.2/gems/sprockets-3.0.2/lib/sprockets/processor_utils.rb:75:in `call_processor'
/Users/Trevor/.rvm/gems/ruby-2.2.2/gems/sprockets-3.0.2/lib/sprockets/processor_utils.rb:57:in `block in call_processors'
/Users/Trevor/.rvm/gems/ruby-2.2.2/gems/sprockets-3.0.2/lib/sprockets/processor_utils.rb:56:in `reverse_each'
/Users/Trevor/.rvm/gems/ruby-2.2.2/gems/sprockets-3.0.2/lib/sprockets/processor_utils.rb:56:in `call_processors'
/Users/Trevor/.rvm/gems/ruby-2.2.2/gems/sprockets-3.0.2/lib/sprockets/loader.rb:103:in `load_asset_by_uri'
/Users/Trevor/.rvm/gems/ruby-2.2.2/gems/sprockets-3.0.2/lib/sprockets/loader.rb:40:in `block in load'
/Users/Trevor/.rvm/gems/ruby-2.2.2/gems/sprockets-3.0.2/lib/sprockets/loader.rb:171:in `fetch_asset_from_dependency_cache'
/Users/Trevor/.rvm/gems/ruby-2.2.2/gems/sprockets-3.0.2/lib/sprockets/loader.rb:33:in `load'
/Users/Trevor/.rvm/gems/ruby-2.2.2/gems/sprockets-3.0.2/lib/sprockets/cached_environment.rb:20:in `block in initialize'
/Users/Trevor/.rvm/gems/ruby-2.2.2/gems/sprockets-3.0.2/lib/sprockets/cached_environment.rb:47:in `yield'
/Users/Trevor/.rvm/gems/ruby-2.2.2/gems/sprockets-3.0.2/lib/sprockets/cached_environment.rb:47:in `load'
/Users/Trevor/.rvm/gems/ruby-2.2.2/gems/sprockets-3.0.2/lib/sprockets/bundle.rb:23:in `block in call'
/Users/Trevor/.rvm/gems/ruby-2.2.2/gems/sprockets-3.0.2/lib/sprockets/utils.rb:183:in `dfs'
/Users/Trevor/.rvm/gems/ruby-2.2.2/gems/sprockets-3.0.2/lib/sprockets/bundle.rb:24:in `call'
/Users/Trevor/.rvm/gems/ruby-2.2.2/gems/sprockets-3.0.2/lib/sprockets/processor_utils.rb:75:in `call_processor'
/Users/Trevor/.rvm/gems/ruby-2.2.2/gems/sprockets-3.0.2/lib/sprockets/processor_utils.rb:57:in `block in call_processors'
/Users/Trevor/.rvm/gems/ruby-2.2.2/gems/sprockets-3.0.2/lib/sprockets/processor_utils.rb:56:in `reverse_each'
/Users/Trevor/.rvm/gems/ruby-2.2.2/gems/sprockets-3.0.2/lib/sprockets/processor_utils.rb:56:in `call_processors'
/Users/Trevor/.rvm/gems/ruby-2.2.2/gems/sprockets-3.0.2/lib/sprockets/loader.rb:103:in `load_asset_by_uri'
/Users/Trevor/.rvm/gems/ruby-2.2.2/gems/sprockets-3.0.2/lib/sprockets/loader.rb:40:in `block in load'
/Users/Trevor/.rvm/gems/ruby-2.2.2/gems/sprockets-3.0.2/lib/sprockets/loader.rb:171:in `fetch_asset_from_dependency_cache'
/Users/Trevor/.rvm/gems/ruby-2.2.2/gems/sprockets-3.0.2/lib/sprockets/loader.rb:33:in `load'
/Users/Trevor/.rvm/gems/ruby-2.2.2/gems/sprockets-3.0.2/lib/sprockets/cached_environment.rb:20:in `block in initialize'
/Users/Trevor/.rvm/gems/ruby-2.2.2/gems/sprockets-3.0.2/lib/sprockets/cached_environment.rb:47:in `yield'
/Users/Trevor/.rvm/gems/ruby-2.2.2/gems/sprockets-3.0.2/lib/sprockets/cached_environment.rb:47:in `load'
/Users/Trevor/.rvm/gems/ruby-2.2.2/gems/sprockets-3.0.2/lib/sprockets/base.rb:63:in `find_asset'
/Users/Trevor/.rvm/gems/ruby-2.2.2/gems/sprockets-3.0.2/lib/sprockets/base.rb:70:in `find_all_linked_assets'
/Users/Trevor/.rvm/gems/ruby-2.2.2/gems/sprockets-3.0.2/lib/sprockets/manifest.rb:138:in `block in find'
/Users/Trevor/.rvm/gems/ruby-2.2.2/gems/sprockets-3.0.2/lib/sprockets/legacy.rb:114:in `block (2 levels) in logical_paths'
/Users/Trevor/.rvm/gems/ruby-2.2.2/gems/sprockets-3.0.2/lib/sprockets/path_utils.rb:223:in `block in stat_tree'
/Users/Trevor/.rvm/gems/ruby-2.2.2/gems/sprockets-3.0.2/lib/sprockets/path_utils.rb:207:in `block in stat_directory'
/Users/Trevor/.rvm/gems/ruby-2.2.2/gems/sprockets-3.0.2/lib/sprockets/path_utils.rb:204:in `each'
/Users/Trevor/.rvm/gems/ruby-2.2.2/gems/sprockets-3.0.2/lib/sprockets/path_utils.rb:204:in `stat_directory'
/Users/Trevor/.rvm/gems/ruby-2.2.2/gems/sprockets-3.0.2/lib/sprockets/path_utils.rb:222:in `stat_tree'
/Users/Trevor/.rvm/gems/ruby-2.2.2/gems/sprockets-3.0.2/lib/sprockets/legacy.rb:105:in `each'
/Users/Trevor/.rvm/gems/ruby-2.2.2/gems/sprockets-3.0.2/lib/sprockets/legacy.rb:105:in `block in logical_paths'
/Users/Trevor/.rvm/gems/ruby-2.2.2/gems/sprockets-3.0.2/lib/sprockets/legacy.rb:104:in `each'
/Users/Trevor/.rvm/gems/ruby-2.2.2/gems/sprockets-3.0.2/lib/sprockets/legacy.rb:104:in `logical_paths'
/Users/Trevor/.rvm/gems/ruby-2.2.2/gems/sprockets-3.0.2/lib/sprockets/manifest.rb:136:in `find'
/Users/Trevor/.rvm/gems/ruby-2.2.2/gems/sprockets-3.0.2/lib/sprockets/manifest.rb:162:in `compile'
/Users/Trevor/.rvm/gems/ruby-2.2.2/gems/sprockets-rails-2.2.4/lib/sprockets/rails/task.rb:70:in `block (3 levels) in define'
/Users/Trevor/.rvm/gems/ruby-2.2.2/gems/sprockets-3.0.2/lib/rake/sprocketstask.rb:147:in `with_logger'
/Users/Trevor/.rvm/gems/ruby-2.2.2/gems/sprockets-rails-2.2.4/lib/sprockets/rails/task.rb:69:in `block (2 levels) in define'
Tasks: TOP => assets:precompile
(See full trace by running task with --trace)
答案 0 :(得分:0)
事实证明,我已经将所有文件添加到预编译基本上,这搞砸了预编译顺序。它甚至试图在不需要时预编译bootstrap-sass gem。通过删除一堆通配符解决了问题。
以下是assets.rb
中的问题行:
Rails.application.config.assets.precompile += %w( gritter/* *.js *.css *.png *.gif *.jpeg *.jpg )
我把它改为:
Rails.application.config.assets.precompile += %w( gritter/* fancybox/* welcome.js )