我为我的rails应用程序购买了一个主题,不幸的是它有很多css错误。当我尝试预编译资产时,会弹出此错误
Invalid CSS after " margin-top:": expected expression (e.g. 1px, bold), was "}"
(in /home/ubuntu/rails_app/app/assets/stylesheets/application.css)
(sass):6109
/home/ubuntu/.rvm/gems/ruby-2.0.0-p0/gems/sass-3.2.9/lib/sass/scss/parser.rb:1146:in `expected'
/home/ubuntu/.rvm/gems/ruby-2.0.0-p0/gems/sass-3.2.9/lib/sass/script/lexer.rb:199:in `expected!'
/home/ubuntu/.rvm/gems/ruby-2.0.0-p0/gems/sass-3.2.9/lib/sass/script/parser.rb:471:in `assert_expr'
/home/ubuntu/.rvm/gems/ruby-2.0.0-p0/gems/sass-3.2.9/lib/sass/script/parser.rb:49:in `parse'
/home/ubuntu/.rvm/gems/ruby-2.0.0-p0/gems/sass-3.2.9/lib/sass/scss/parser.rb:1022:in `sass_script'
/home/ubuntu/.rvm/gems/ruby-2.0.0-p0/gems/sass-3.2.9/lib/sass/scss/parser.rb:882:in `value!'
/home/ubuntu/.rvm/gems/ruby-2.0.0-p0/gems/sass-3.2.9/lib/sass/scss/parser.rb:859:in `declaration'
/home/ubuntu/.rvm/gems/ruby-2.0.0-p0/gems/sass-3.2.9/lib/sass/scss/parser.rb:582:in `block in declaration_or_ruleset'
/home/ubuntu/.rvm/gems/ruby-2.0.0-p0/gems/sass-3.2.9/lib/sass/scss/parser.rb:1122:in `call'
/home/ubuntu/.rvm/gems/ruby-2.0.0-p0/gems/sass-3.2.9/lib/sass/scss/parser.rb:1122:in `rethrow'
/home/ubuntu/.rvm/gems/ruby-2.0.0-p0/gems/sass-3.2.9/lib/sass/scss/parser.rb:592:in `declaration_or_ruleset'
/home/ubuntu/.rvm/gems/ruby-2.0.0-p0/gems/sass-3.2.9/lib/sass/scss/parser.rb:554:in `block_child'
/home/ubuntu/.rvm/gems/ruby-2.0.0-p0/gems/sass-3.2.9/lib/sass/scss/parser.rb:546:in `block_contents'
/home/ubuntu/.rvm/gems/ruby-2.0.0-p0/gems/sass-3.2.9/lib/sass/scss/parser.rb:535:in `block'
/home/ubuntu/.rvm/gems/ruby-2.0.0-p0/gems/sass-3.2.9/lib/sass/scss/parser.rb:529:in `ruleset'
/home/ubuntu/.rvm/gems/ruby-2.0.0-p0/gems/sass-3.2.9/lib/sass/scss/parser.rb:553:in `block_child'
/home/ubuntu/.rvm/gems/ruby-2.0.0-p0/gems/sass-3.2.9/lib/sass/scss/parser.rb:546:in `block_contents'
/home/ubuntu/.rvm/gems/ruby-2.0.0-p0/gems/sass-3.2.9/lib/sass/scss/parser.rb:82:in `stylesheet'
/home/ubuntu/.rvm/gems/ruby-2.0.0-p0/gems/sass-3.2.9/lib/sass/scss/parser.rb:27:in `parse'
/home/ubuntu/.rvm/gems/ruby-2.0.0-p0/gems/sass-3.2.9/lib/sass/engine.rb:342:in `_to_tree'
/home/ubuntu/.rvm/gems/ruby-2.0.0-p0/gems/sass-3.2.9/lib/sass/engine.rb:315:in `_render'
/home/ubuntu/.rvm/gems/ruby-2.0.0-p0/gems/sass-3.2.9/lib/sass/engine.rb:262:in `render'
/home/ubuntu/.rvm/gems/ruby-2.0.0-p0@global/gems/sass-rails-3.2.6/lib/sass/rails/compressor.rb:16:in `compress'
/home/ubuntu/.rvm/gems/ruby-2.0.0-p0/gems/actionpack-3.2.13/lib/sprockets/compressors.rb:74:in `compress'
/home/ubuntu/.rvm/gems/ruby-2.0.0-p0@global/gems/sprockets-2.2.2/lib/sprockets/processing.rb:243:in `block in css_compressor='
/home/ubuntu/.rvm/gems/ruby-2.0.0-p0@global/gems/sprockets-2.2.2/lib/sprockets/processor.rb:29:in `call'
/home/ubuntu/.rvm/gems/ruby-2.0.0-p0@global/gems/sprockets-2.2.2/lib/sprockets/processor.rb:29:in `evaluate'
/home/ubuntu/.rvm/gems/ruby-2.0.0-p0/gems/tilt-1.4.1/lib/tilt/template.rb:103:in `render'
/home/ubuntu/.rvm/gems/ruby-2.0.0-p0@global/gems/sprockets-2.2.2/lib/sprockets/context.rb:193:in `block in evaluate'
/home/ubuntu/.rvm/gems/ruby-2.0.0-p0@global/gems/sprockets-2.2.2/lib/sprockets/context.rb:190:in `each'
/home/ubuntu/.rvm/gems/ruby-2.0.0-p0@global/gems/sprockets-2.2.2/lib/sprockets/context.rb:190:in `evaluate'
/home/ubuntu/.rvm/gems/ruby-2.0.0-p0@global/gems/sprockets-2.2.2/lib/sprockets/bundled_asset.rb:26:in `initialize'
/home/ubuntu/.rvm/gems/ruby-2.0.0-p0@global/gems/sprockets-2.2.2/lib/sprockets/base.rb:252:in `new'
/home/ubuntu/.rvm/gems/ruby-2.0.0-p0@global/gems/sprockets-2.2.2/lib/sprockets/base.rb:252:in `build_asset'
/home/ubuntu/.rvm/gems/ruby-2.0.0-p0@global/gems/sprockets-2.2.2/lib/sprockets/index.rb:93:in `block in build_asset'
/home/ubuntu/.rvm/gems/ruby-2.0.0-p0@global/gems/sprockets-2.2.2/lib/sprockets/caching.rb:19:in `cache_asset'
/home/ubuntu/.rvm/gems/ruby-2.0.0-p0@global/gems/sprockets-2.2.2/lib/sprockets/index.rb:92:in `build_asset'
/home/ubuntu/.rvm/gems/ruby-2.0.0-p0@global/gems/sprockets-2.2.2/lib/sprockets/base.rb:169:in `find_asset'
/home/ubuntu/.rvm/gems/ruby-2.0.0-p0@global/gems/sprockets-2.2.2/lib/sprockets/index.rb:60:in `find_asset'
/home/ubuntu/.rvm/gems/ruby-2.0.0-p0/gems/actionpack-3.2.13/lib/sprockets/static_compiler.rb:19:in `block in compile'
/home/ubuntu/.rvm/gems/ruby-2.0.0-p0@global/gems/sprockets-2.2.2/lib/sprockets/base.rb:219:in `block in each_logical_path'
/home/ubuntu/.rvm/gems/ruby-2.0.0-p0@global/gems/sprockets-2.2.2/lib/sprockets/base.rb:206:in `block (2 levels) in each_file'
/home/ubuntu/.rvm/gems/ruby-2.0.0-p0@global/gems/sprockets-2.2.2/lib/sprockets/base.rb:196:in `each'
/home/ubuntu/.rvm/gems/ruby-2.0.0-p0@global/gems/sprockets-2.2.2/lib/sprockets/base.rb:196:in `each_entry'
/home/ubuntu/.rvm/gems/ruby-2.0.0-p0@global/gems/sprockets-2.2.2/lib/sprockets/base.rb:204:in `block in each_file'
/home/ubuntu/.rvm/gems/ruby-2.0.0-p0@global/gems/sprockets-2.2.2/lib/sprockets/base.rb:203:in `each'
/home/ubuntu/.rvm/gems/ruby-2.0.0-p0@global/gems/sprockets-2.2.2/lib/sprockets/base.rb:203:in `each_file'
/home/ubuntu/.rvm/gems/ruby-2.0.0-p0@global/gems/sprockets-2.2.2/lib/sprockets/base.rb:217:in `each_logical_path'
/home/ubuntu/.rvm/gems/ruby-2.0.0-p0/gems/actionpack-3.2.13/lib/sprockets/static_compiler.rb:18:in `compile'
/home/ubuntu/.rvm/gems/ruby-2.0.0-p0/gems/actionpack-3.2.13/lib/sprockets/assets.rake:56:in `internal_precompile'
/home/ubuntu/.rvm/gems/ruby-2.0.0-p0/gems/actionpack-3.2.13/lib/sprockets/assets.rake:70:in `block (3 levels) in <top (required)>'
/home/ubuntu/.rvm/gems/ruby-2.0.0-p0@global/gems/rake-10.0.4/lib/rake/task.rb:246:in `call'
/home/ubuntu/.rvm/gems/ruby-2.0.0-p0@global/gems/rake-10.0.4/lib/rake/task.rb:246:in `block in execute'
/home/ubuntu/.rvm/gems/ruby-2.0.0-p0@global/gems/rake-10.0.4/lib/rake/task.rb:241:in `each'
/home/ubuntu/.rvm/gems/ruby-2.0.0-p0@global/gems/rake-10.0.4/lib/rake/task.rb:241:in `execute'
/home/ubuntu/.rvm/gems/ruby-2.0.0-p0@global/gems/rake-10.0.4/lib/rake/task.rb:184:in `block in invoke_with_call_chain'
/home/ubuntu/.rvm/rubies/ruby-2.0.0-p0/lib/ruby/2.0.0/monitor.rb:211:in `mon_synchronize'
/home/ubuntu/.rvm/gems/ruby-2.0.0-p0@global/gems/rake-10.0.4/lib/rake/task.rb:177:in `invoke_with_call_chain'
/home/ubuntu/.rvm/gems/ruby-2.0.0-p0@global/gems/rake-10.0.4/lib/rake/task.rb:170:in `invoke'
/home/ubuntu/.rvm/gems/ruby-2.0.0-p0/gems/actionpack-3.2.13/lib/sprockets/assets.rake:60:in `block (3 levels) in <top (required)>'
/home/ubuntu/.rvm/gems/ruby-2.0.0-p0@global/gems/rake-10.0.4/lib/rake/task.rb:246:in `call'
/home/ubuntu/.rvm/gems/ruby-2.0.0-p0@global/gems/rake-10.0.4/lib/rake/task.rb:246:in `block in execute'
/home/ubuntu/.rvm/gems/ruby-2.0.0-p0@global/gems/rake-10.0.4/lib/rake/task.rb:241:in `each'
/home/ubuntu/.rvm/gems/ruby-2.0.0-p0@global/gems/rake-10.0.4/lib/rake/task.rb:241:in `execute'
/home/ubuntu/.rvm/gems/ruby-2.0.0-p0@global/gems/rake-10.0.4/lib/rake/task.rb:184:in `block in invoke_with_call_chain'
/home/ubuntu/.rvm/rubies/ruby-2.0.0-p0/lib/ruby/2.0.0/monitor.rb:211:in `mon_synchronize'
/home/ubuntu/.rvm/gems/ruby-2.0.0-p0@global/gems/rake-10.0.4/lib/rake/task.rb:177:in `invoke_with_call_chain'
/home/ubuntu/.rvm/gems/ruby-2.0.0-p0@global/gems/rake-10.0.4/lib/rake/task.rb:170:in `invoke'
/home/ubuntu/.rvm/gems/ruby-2.0.0-p0@global/gems/rake-10.0.4/lib/rake/application.rb:143:in `invoke_task'
/home/ubuntu/.rvm/gems/ruby-2.0.0-p0@global/gems/rake-10.0.4/lib/rake/application.rb:101:in `block (2 levels) in top_level'
/home/ubuntu/.rvm/gems/ruby-2.0.0-p0@global/gems/rake-10.0.4/lib/rake/application.rb:101:in `each'
/home/ubuntu/.rvm/gems/ruby-2.0.0-p0@global/gems/rake-10.0.4/lib/rake/application.rb:101:in `block in top_level'
/home/ubuntu/.rvm/gems/ruby-2.0.0-p0@global/gems/rake-10.0.4/lib/rake/application.rb:110:in `run_with_threads'
/home/ubuntu/.rvm/gems/ruby-2.0.0-p0@global/gems/rake-10.0.4/lib/rake/application.rb:95:in `top_level'
/home/ubuntu/.rvm/gems/ruby-2.0.0-p0@global/gems/rake-10.0.4/lib/rake/application.rb:73:in `block in run'
/home/ubuntu/.rvm/gems/ruby-2.0.0-p0@global/gems/rake-10.0.4/lib/rake/application.rb:160:in `standard_exception_handling'
/home/ubuntu/.rvm/gems/ruby-2.0.0-p0@global/gems/rake-10.0.4/lib/rake/application.rb:70:in `run'
/home/ubuntu/.rvm/gems/ruby-2.0.0-p0@global/gems/rake-10.0.4/bin/rake:33:in `<top (required)>'
/home/ubuntu/.rvm/gems/ruby-2.0.0-p0/bin/rake:23:in `load'
/home/ubuntu/.rvm/gems/ruby-2.0.0-p0/bin/rake:23:in `<main>'
Tasks: TOP => assets:precompile:primary
rake aborted!
Command failed with status (1): [/home/ubuntu/.rvm/rubies/ruby-2.0.0-p0/bi...]
/home/ubuntu/.rvm/gems/ruby-2.0.0-p0@global/gems/rake-10.0.4/lib/rake/file_utils.rb:53:in `block in create_shell_runner'
/home/ubuntu/.rvm/gems/ruby-2.0.0-p0@global/gems/rake-10.0.4/lib/rake/file_utils.rb:45:in `call'
/home/ubuntu/.rvm/gems/ruby-2.0.0-p0@global/gems/rake-10.0.4/lib/rake/file_utils.rb:45:in `sh'
/home/ubuntu/.rvm/gems/ruby-2.0.0-p0@global/gems/rake-10.0.4/lib/rake/file_utils_ext.rb:37:in `sh'
/home/ubuntu/.rvm/gems/ruby-2.0.0-p0@global/gems/rake-10.0.4/lib/rake/file_utils.rb:80:in `ruby'
/home/ubuntu/.rvm/gems/ruby-2.0.0-p0@global/gems/rake-10.0.4/lib/rake/file_utils_ext.rb:37:in `ruby'
/home/ubuntu/.rvm/gems/ruby-2.0.0-p0/gems/actionpack-3.2.13/lib/sprockets/assets.rake:12:in `ruby_rake_task'
/home/ubuntu/.rvm/gems/ruby-2.0.0-p0/gems/actionpack-3.2.13/lib/sprockets/assets.rake:21:in `invoke_or_reboot_rake_task'
/home/ubuntu/.rvm/gems/ruby-2.0.0-p0/gems/actionpack-3.2.13/lib/sprockets/assets.rake:29:in `block (2 levels) in <top (required)>'
/home/ubuntu/.rvm/gems/ruby-2.0.0-p0@global/gems/rake-10.0.4/lib/rake/task.rb:246:in `call'
/home/ubuntu/.rvm/gems/ruby-2.0.0-p0@global/gems/rake-10.0.4/lib/rake/task.rb:246:in `block in execute'
/home/ubuntu/.rvm/gems/ruby-2.0.0-p0@global/gems/rake-10.0.4/lib/rake/task.rb:241:in `each'
/home/ubuntu/.rvm/gems/ruby-2.0.0-p0@global/gems/rake-10.0.4/lib/rake/task.rb:241:in `execute'
/home/ubuntu/.rvm/gems/ruby-2.0.0-p0@global/gems/rake-10.0.4/lib/rake/task.rb:184:in `block in invoke_with_call_chain'
/home/ubuntu/.rvm/rubies/ruby-2.0.0-p0/lib/ruby/2.0.0/monitor.rb:211:in `mon_synchronize'
/home/ubuntu/.rvm/gems/ruby-2.0.0-p0@global/gems/rake-10.0.4/lib/rake/task.rb:177:in `invoke_with_call_chain'
/home/ubuntu/.rvm/gems/ruby-2.0.0-p0@global/gems/rake-10.0.4/lib/rake/task.rb:170:in `invoke'
/home/ubuntu/.rvm/gems/ruby-2.0.0-p0@global/gems/rake-10.0.4/lib/rake/application.rb:143:in `invoke_task'
/home/ubuntu/.rvm/gems/ruby-2.0.0-p0@global/gems/rake-10.0.4/lib/rake/application.rb:101:in `block (2 levels) in top_level'
/home/ubuntu/.rvm/gems/ruby-2.0.0-p0@global/gems/rake-10.0.4/lib/rake/application.rb:101:in `each'
/home/ubuntu/.rvm/gems/ruby-2.0.0-p0@global/gems/rake-10.0.4/lib/rake/application.rb:101:in `block in top_level'
/home/ubuntu/.rvm/gems/ruby-2.0.0-p0@global/gems/rake-10.0.4/lib/rake/application.rb:110:in `run_with_threads'
/home/ubuntu/.rvm/gems/ruby-2.0.0-p0@global/gems/rake-10.0.4/lib/rake/application.rb:95:in `top_level'
/home/ubuntu/.rvm/gems/ruby-2.0.0-p0@global/gems/rake-10.0.4/lib/rake/application.rb:73:in `block in run'
/home/ubuntu/.rvm/gems/ruby-2.0.0-p0@global/gems/rake-10.0.4/lib/rake/application.rb:160:in `standard_exception_handling'
/home/ubuntu/.rvm/gems/ruby-2.0.0-p0@global/gems/rake-10.0.4/lib/rake/application.rb:70:in `run'
/home/ubuntu/.rvm/gems/ruby-2.0.0-p0@global/gems/rake-10.0.4/bin/rake:33:in `<top (required)>'
/home/ubuntu/.rvm/gems/ruby-2.0.0-p0/bin/rake:23:in `load'
/home/ubuntu/.rvm/gems/ruby-2.0.0-p0/bin/rake:23:in `<main>'
/home/ubuntu/.rvm/gems/ruby-2.0.0-p0/bin/ruby_noexec_wrapper:14:in `eval'
/home/ubuntu/.rvm/gems/ruby-2.0.0-p0/bin/ruby_noexec_wrapper:14:in `<main>'
Tasks: TOP => assets:precompile
我怎么能确切地找到错误发生在css文件的哪一行,因为在{c}文件中使用margin-top
超过500次。
由于
答案 0 :(得分:0)
我会对文件执行ack-grep并获取margin-top的所有位置。
您正在寻找的是一个保证金顶级声明,没有与之相关的表达式。应该很清楚,那里什么也没有,但是这可能只是一个非常混乱的文件,很难阅读。
编辑:
ack-grep margin-top: .
只会在目录中查找所有出现的margin-top:。如果你想使用任何其他正则表达式寻找更具体的东西,你可以用ack-grep来做。