如何将Rails 3.2的“wrap bootstrap”主题上传到Heroku

时间:2012-12-18 03:03:57

标签: heroku twitter-bootstrap ruby-on-rails-3.2 twitter-bootstrap-rails

我从http://wrapbootstrap.com购买了一个主题。

主题说:“使用少:否” 使用Bootstrap 2.2.1,HTML5 / CSS3

制作

我无法让主题工作/上传到Heroku。有谁知道我做错了什么?主题在localhost上正常运行。当我尝试在上传到Heroku之前预编译资产时,我得到:

$ RAILS_ENV=production bundle exec rake assets:precompile --trace
** Invoke assets:precompile (first_time)
** Execute assets:precompile
/Users/mark/.rvm/rubies/ruby-1.9.3-p125/bin/ruby /Users/mark/.rvm/gems/ruby-1.9.3-p125@linkedsocial/bin/rake assets:precompile:all RAILS_ENV=production RAILS_GROUPS=assets --trace
** Invoke assets:precompile:all (first_time)
** Execute assets:precompile:all
** Invoke assets:precompile:primary (first_time)
** Invoke assets:environment (first_time)
** Execute assets:environment
** Invoke tmp:cache:clear (first_time)
** Execute tmp:cache:clear
** Execute assets:precompile:primary
rake aborted!
Invalid CSS after "  width: ": expected expression (e.g. 1px, bold), was ";"
  (in /Users/mark/Documents/websites/hosting/linkedsocial/app/assets/stylesheets/application.css)
(sass):10934
/Users/mark/.rvm/gems/ruby-1.9.3-p125@linkedsocial/gems/sass-3.2.3/lib/sass/scss/parser.rb:1134:in `expected'
/Users/mark/.rvm/gems/ruby-1.9.3-p125@linkedsocial/gems/sass-3.2.3/lib/sass/script/lexer.rb:199:in `expected!'
/Users/mark/.rvm/gems/ruby-1.9.3-p125@linkedsocial/gems/sass-3.2.3/lib/sass/script/parser.rb:471:in `assert_expr'
/Users/mark/.rvm/gems/ruby-1.9.3-p125@linkedsocial/gems/sass-3.2.3/lib/sass/script/parser.rb:49:in `parse'
/Users/mark/.rvm/gems/ruby-1.9.3-p125@linkedsocial/gems/sass-3.2.3/lib/sass/scss/parser.rb:1008:in `sass_script'
/Users/mark/.rvm/gems/ruby-1.9.3-p125@linkedsocial/gems/sass-3.2.3/lib/sass/scss/parser.rb:868:in `value!'
/Users/mark/.rvm/gems/ruby-1.9.3-p125@linkedsocial/gems/sass-3.2.3/lib/sass/scss/parser.rb:845:in `declaration'
/Users/mark/.rvm/gems/ruby-1.9.3-p125@linkedsocial/gems/sass-3.2.3/lib/sass/scss/parser.rb:568:in `block in declaration_or_ruleset'
/Users/mark/.rvm/gems/ruby-1.9.3-p125@linkedsocial/gems/sass-3.2.3/lib/sass/scss/parser.rb:1108:in `call'
/Users/mark/.rvm/gems/ruby-1.9.3-p125@linkedsocial/gems/sass-3.2.3/lib/sass/scss/parser.rb:1108:in `rethrow'
/Users/mark/.rvm/gems/ruby-1.9.3-p125@linkedsocial/gems/sass-3.2.3/lib/sass/scss/parser.rb:578:in `declaration_or_ruleset'
/Users/mark/.rvm/gems/ruby-1.9.3-p125@linkedsocial/gems/sass-3.2.3/lib/sass/scss/parser.rb:540:in `block_child'
/Users/mark/.rvm/gems/ruby-1.9.3-p125@linkedsocial/gems/sass-3.2.3/lib/sass/scss/parser.rb:532:in `block_contents'
/Users/mark/.rvm/gems/ruby-1.9.3-p125@linkedsocial/gems/sass-3.2.3/lib/sass/scss/parser.rb:521:in `block'
/Users/mark/.rvm/gems/ruby-1.9.3-p125@linkedsocial/gems/sass-3.2.3/lib/sass/scss/parser.rb:515:in `ruleset'
/Users/mark/.rvm/gems/ruby-1.9.3-p125@linkedsocial/gems/sass-3.2.3/lib/sass/scss/parser.rb:539:in `block_child'
/Users/mark/.rvm/gems/ruby-1.9.3-p125@linkedsocial/gems/sass-3.2.3/lib/sass/scss/parser.rb:532:in `block_contents'
/Users/mark/.rvm/gems/ruby-1.9.3-p125@linkedsocial/gems/sass-3.2.3/lib/sass/scss/parser.rb:70:in `stylesheet'
/Users/mark/.rvm/gems/ruby-1.9.3-p125@linkedsocial/gems/sass-3.2.3/lib/sass/scss/parser.rb:27:in `parse'
/Users/mark/.rvm/gems/ruby-1.9.3-p125@linkedsocial/gems/sass-3.2.3/lib/sass/engine.rb:342:in `_to_tree'
/Users/mark/.rvm/gems/ruby-1.9.3-p125@linkedsocial/gems/sass-3.2.3/lib/sass/engine.rb:315:in `_render'
/Users/mark/.rvm/gems/ruby-1.9.3-p125@linkedsocial/gems/sass-3.2.3/lib/sass/engine.rb:262:in `render'
/Users/mark/.rvm/gems/ruby-1.9.3-p125@linkedsocial/gems/sass-rails-3.2.5/lib/sass/rails/compressor.rb:8:in `compress'
/Users/mark/.rvm/gems/ruby-1.9.3-p125@linkedsocial/gems/actionpack-3.2.9/lib/sprockets/compressors.rb:74:in `compress'
/Users/mark/.rvm/gems/ruby-1.9.3-p125@linkedsocial/gems/sprockets-2.2.2/lib/sprockets/processing.rb:243:in `block in css_compressor='
/Users/mark/.rvm/gems/ruby-1.9.3-p125@linkedsocial/gems/sprockets-2.2.2/lib/sprockets/processor.rb:29:in `call'
/Users/mark/.rvm/gems/ruby-1.9.3-p125@linkedsocial/gems/sprockets-2.2.2/lib/sprockets/processor.rb:29:in `evaluate'
/Users/mark/.rvm/gems/ruby-1.9.3-p125@linkedsocial/gems/tilt-1.3.3/lib/tilt/template.rb:76:in `render'
/Users/mark/.rvm/gems/ruby-1.9.3-p125@linkedsocial/gems/sprockets-2.2.2/lib/sprockets/context.rb:193:in `block in evaluate'
/Users/mark/.rvm/gems/ruby-1.9.3-p125@linkedsocial/gems/sprockets-2.2.2/lib/sprockets/context.rb:190:in `each'
/Users/mark/.rvm/gems/ruby-1.9.3-p125@linkedsocial/gems/sprockets-2.2.2/lib/sprockets/context.rb:190:in `evaluate'
/Users/mark/.rvm/gems/ruby-1.9.3-p125@linkedsocial/gems/sprockets-2.2.2/lib/sprockets/bundled_asset.rb:26:in `initialize'
/Users/mark/.rvm/gems/ruby-1.9.3-p125@linkedsocial/gems/sprockets-2.2.2/lib/sprockets/base.rb:252:in `new'
/Users/mark/.rvm/gems/ruby-1.9.3-p125@linkedsocial/gems/sprockets-2.2.2/lib/sprockets/base.rb:252:in `build_asset'
/Users/mark/.rvm/gems/ruby-1.9.3-p125@linkedsocial/gems/sprockets-2.2.2/lib/sprockets/index.rb:93:in `block in build_asset'
/Users/mark/.rvm/gems/ruby-1.9.3-p125@linkedsocial/gems/sprockets-2.2.2/lib/sprockets/caching.rb:19:in `cache_asset'
/Users/mark/.rvm/gems/ruby-1.9.3-p125@linkedsocial/gems/sprockets-2.2.2/lib/sprockets/index.rb:92:in `build_asset'
/Users/mark/.rvm/gems/ruby-1.9.3-p125@linkedsocial/gems/sprockets-2.2.2/lib/sprockets/base.rb:169:in `find_asset'
/Users/mark/.rvm/gems/ruby-1.9.3-p125@linkedsocial/gems/sprockets-2.2.2/lib/sprockets/index.rb:60:in `find_asset'
/Users/mark/.rvm/gems/ruby-1.9.3-p125@linkedsocial/gems/actionpack-3.2.9/lib/sprockets/static_compiler.rb:19:in `block in compile'
/Users/mark/.rvm/gems/ruby-1.9.3-p125@linkedsocial/gems/sprockets-2.2.2/lib/sprockets/base.rb:219:in `block in each_logical_path'
/Users/mark/.rvm/gems/ruby-1.9.3-p125@linkedsocial/gems/sprockets-2.2.2/lib/sprockets/base.rb:206:in `block (2 levels) in each_file'
/Users/mark/.rvm/gems/ruby-1.9.3-p125@linkedsocial/gems/sprockets-2.2.2/lib/sprockets/base.rb:196:in `each'
/Users/mark/.rvm/gems/ruby-1.9.3-p125@linkedsocial/gems/sprockets-2.2.2/lib/sprockets/base.rb:196:in `each_entry'
/Users/mark/.rvm/gems/ruby-1.9.3-p125@linkedsocial/gems/sprockets-2.2.2/lib/sprockets/base.rb:204:in `block in each_file'
/Users/mark/.rvm/gems/ruby-1.9.3-p125@linkedsocial/gems/sprockets-2.2.2/lib/sprockets/base.rb:203:in `each'
/Users/mark/.rvm/gems/ruby-1.9.3-p125@linkedsocial/gems/sprockets-2.2.2/lib/sprockets/base.rb:203:in `each_file'
/Users/mark/.rvm/gems/ruby-1.9.3-p125@linkedsocial/gems/sprockets-2.2.2/lib/sprockets/base.rb:217:in `each_logical_path'
/Users/mark/.rvm/gems/ruby-1.9.3-p125@linkedsocial/gems/actionpack-3.2.9/lib/sprockets/static_compiler.rb:18:in `compile'
/Users/mark/.rvm/gems/ruby-1.9.3-p125@linkedsocial/gems/actionpack-3.2.9/lib/sprockets/assets.rake:56:in `internal_precompile'
/Users/mark/.rvm/gems/ruby-1.9.3-p125@linkedsocial/gems/actionpack-3.2.9/lib/sprockets/assets.rake:70:in `block (3 levels) in <top (required)>'
/Users/mark/.rvm/gems/ruby-1.9.3-p125@linkedsocial/gems/rake-10.0.2/lib/rake/task.rb:227:in `call'
/Users/mark/.rvm/gems/ruby-1.9.3-p125@linkedsocial/gems/rake-10.0.2/lib/rake/task.rb:227:in `block in execute'
/Users/mark/.rvm/gems/ruby-1.9.3-p125@linkedsocial/gems/rake-10.0.2/lib/rake/task.rb:222:in `each'
/Users/mark/.rvm/gems/ruby-1.9.3-p125@linkedsocial/gems/rake-10.0.2/lib/rake/task.rb:222:in `execute'
/Users/mark/.rvm/gems/ruby-1.9.3-p125@linkedsocial/gems/rake-10.0.2/lib/rake/task.rb:166:in `block in invoke_with_call_chain'
/Users/mark/.rvm/rubies/ruby-1.9.3-p125/lib/ruby/1.9.1/monitor.rb:211:in `mon_synchronize'
/Users/mark/.rvm/gems/ruby-1.9.3-p125@linkedsocial/gems/rake-10.0.2/lib/rake/task.rb:159:in `invoke_with_call_chain'
/Users/mark/.rvm/gems/ruby-1.9.3-p125@linkedsocial/gems/rake-10.0.2/lib/rake/task.rb:152:in `invoke'
/Users/mark/.rvm/gems/ruby-1.9.3-p125@linkedsocial/gems/actionpack-3.2.9/lib/sprockets/assets.rake:60:in `block (3 levels) in <top (required)>'
/Users/mark/.rvm/gems/ruby-1.9.3-p125@linkedsocial/gems/rake-10.0.2/lib/rake/task.rb:227:in `call'
/Users/mark/.rvm/gems/ruby-1.9.3-p125@linkedsocial/gems/rake-10.0.2/lib/rake/task.rb:227:in `block in execute'
/Users/mark/.rvm/gems/ruby-1.9.3-p125@linkedsocial/gems/rake-10.0.2/lib/rake/task.rb:222:in `each'
/Users/mark/.rvm/gems/ruby-1.9.3-p125@linkedsocial/gems/rake-10.0.2/lib/rake/task.rb:222:in `execute'
/Users/mark/.rvm/gems/ruby-1.9.3-p125@linkedsocial/gems/rake-10.0.2/lib/rake/task.rb:166:in `block in invoke_with_call_chain'
/Users/mark/.rvm/rubies/ruby-1.9.3-p125/lib/ruby/1.9.1/monitor.rb:211:in `mon_synchronize'
/Users/mark/.rvm/gems/ruby-1.9.3-p125@linkedsocial/gems/rake-10.0.2/lib/rake/task.rb:159:in `invoke_with_call_chain'
/Users/mark/.rvm/gems/ruby-1.9.3-p125@linkedsocial/gems/rake-10.0.2/lib/rake/task.rb:152:in `invoke'
/Users/mark/.rvm/gems/ruby-1.9.3-p125@linkedsocial/gems/rake-10.0.2/lib/rake/application.rb:141:in `invoke_task'
/Users/mark/.rvm/gems/ruby-1.9.3-p125@linkedsocial/gems/rake-10.0.2/lib/rake/application.rb:99:in `block (2 levels) in top_level'
/Users/mark/.rvm/gems/ruby-1.9.3-p125@linkedsocial/gems/rake-10.0.2/lib/rake/application.rb:99:in `each'
/Users/mark/.rvm/gems/ruby-1.9.3-p125@linkedsocial/gems/rake-10.0.2/lib/rake/application.rb:99:in `block in top_level'
/Users/mark/.rvm/gems/ruby-1.9.3-p125@linkedsocial/gems/rake-10.0.2/lib/rake/application.rb:108:in `run_with_threads'
/Users/mark/.rvm/gems/ruby-1.9.3-p125@linkedsocial/gems/rake-10.0.2/lib/rake/application.rb:93:in `top_level'
/Users/mark/.rvm/gems/ruby-1.9.3-p125@linkedsocial/gems/rake-10.0.2/lib/rake/application.rb:71:in `block in run'
/Users/mark/.rvm/gems/ruby-1.9.3-p125@linkedsocial/gems/rake-10.0.2/lib/rake/application.rb:158:in `standard_exception_handling'
/Users/mark/.rvm/gems/ruby-1.9.3-p125@linkedsocial/gems/rake-10.0.2/lib/rake/application.rb:68:in `run'
/Users/mark/.rvm/gems/ruby-1.9.3-p125@linkedsocial/gems/rake-10.0.2/bin/rake:37:in `<top (required)>'
/Users/mark/.rvm/gems/ruby-1.9.3-p125@linkedsocial/bin/rake:19:in `load'
/Users/mark/.rvm/gems/ruby-1.9.3-p125@linkedsocial/bin/rake:19:in `<main>'
Tasks: TOP => assets:precompile:primary
rake aborted!
Command failed with status (1): [/Users/mark/.rvm/rubies/ruby-1.9.3-p...]
/Users/mark/.rvm/gems/ruby-1.9.3-p125@linkedsocial/gems/rake-10.0.2/lib/rake/file_utils.rb:53:in `block in create_shell_runner'
/Users/mark/.rvm/gems/ruby-1.9.3-p125@linkedsocial/gems/rake-10.0.2/lib/rake/file_utils.rb:45:in `call'
/Users/mark/.rvm/gems/ruby-1.9.3-p125@linkedsocial/gems/rake-10.0.2/lib/rake/file_utils.rb:45:in `sh'
/Users/mark/.rvm/gems/ruby-1.9.3-p125@linkedsocial/gems/rake-10.0.2/lib/rake/file_utils_ext.rb:40:in `sh'
/Users/mark/.rvm/gems/ruby-1.9.3-p125@linkedsocial/gems/rake-10.0.2/lib/rake/file_utils.rb:80:in `ruby'
/Users/mark/.rvm/gems/ruby-1.9.3-p125@linkedsocial/gems/rake-10.0.2/lib/rake/file_utils_ext.rb:40:in `ruby'
/Users/mark/.rvm/gems/ruby-1.9.3-p125@linkedsocial/gems/actionpack-3.2.9/lib/sprockets/assets.rake:12:in `ruby_rake_task'
/Users/mark/.rvm/gems/ruby-1.9.3-p125@linkedsocial/gems/actionpack-3.2.9/lib/sprockets/assets.rake:21:in `invoke_or_reboot_rake_task'
/Users/mark/.rvm/gems/ruby-1.9.3-p125@linkedsocial/gems/actionpack-3.2.9/lib/sprockets/assets.rake:29:in `block (2 levels) in <top (required)>'
/Users/mark/.rvm/gems/ruby-1.9.3-p125@linkedsocial/gems/rake-10.0.2/lib/rake/task.rb:227:in `call'
/Users/mark/.rvm/gems/ruby-1.9.3-p125@linkedsocial/gems/rake-10.0.2/lib/rake/task.rb:227:in `block in execute'
/Users/mark/.rvm/gems/ruby-1.9.3-p125@linkedsocial/gems/rake-10.0.2/lib/rake/task.rb:222:in `each'
/Users/mark/.rvm/gems/ruby-1.9.3-p125@linkedsocial/gems/rake-10.0.2/lib/rake/task.rb:222:in `execute'
/Users/mark/.rvm/gems/ruby-1.9.3-p125@linkedsocial/gems/rake-10.0.2/lib/rake/task.rb:166:in `block in invoke_with_call_chain'
/Users/mark/.rvm/rubies/ruby-1.9.3-p125/lib/ruby/1.9.1/monitor.rb:211:in `mon_synchronize'
/Users/mark/.rvm/gems/ruby-1.9.3-p125@linkedsocial/gems/rake-10.0.2/lib/rake/task.rb:159:in `invoke_with_call_chain'
/Users/mark/.rvm/gems/ruby-1.9.3-p125@linkedsocial/gems/rake-10.0.2/lib/rake/task.rb:152:in `invoke'
/Users/mark/.rvm/gems/ruby-1.9.3-p125@linkedsocial/gems/rake-10.0.2/lib/rake/application.rb:141:in `invoke_task'
/Users/mark/.rvm/gems/ruby-1.9.3-p125@linkedsocial/gems/rake-10.0.2/lib/rake/application.rb:99:in `block (2 levels) in top_level'
/Users/mark/.rvm/gems/ruby-1.9.3-p125@linkedsocial/gems/rake-10.0.2/lib/rake/application.rb:99:in `each'
/Users/mark/.rvm/gems/ruby-1.9.3-p125@linkedsocial/gems/rake-10.0.2/lib/rake/application.rb:99:in `block in top_level'
/Users/mark/.rvm/gems/ruby-1.9.3-p125@linkedsocial/gems/rake-10.0.2/lib/rake/application.rb:108:in `run_with_threads'
/Users/mark/.rvm/gems/ruby-1.9.3-p125@linkedsocial/gems/rake-10.0.2/lib/rake/application.rb:93:in `top_level'
/Users/mark/.rvm/gems/ruby-1.9.3-p125@linkedsocial/gems/rake-10.0.2/lib/rake/application.rb:71:in `block in run'
/Users/mark/.rvm/gems/ruby-1.9.3-p125@linkedsocial/gems/rake-10.0.2/lib/rake/application.rb:158:in `standard_exception_handling'
/Users/mark/.rvm/gems/ruby-1.9.3-p125@linkedsocial/gems/rake-10.0.2/lib/rake/application.rb:68:in `run'
/Users/mark/.rvm/gems/ruby-1.9.3-p125@linkedsocial/gems/rake-10.0.2/bin/rake:37:in `<top (required)>'
/Users/mark/.rvm/gems/ruby-1.9.3-p125@linkedsocial/bin/rake:19:in `load'
/Users/mark/.rvm/gems/ruby-1.9.3-p125@linkedsocial/bin/rake:19:in `<main>'
/Users/mark/.rvm/gems/ruby-1.9.3-p125@linkedsocial/bin/ruby_noexec_wrapper:14:in `eval'
/Users/mark/.rvm/gems/ruby-1.9.3-p125@linkedsocial/bin/ruby_noexec_wrapper:14:in `<main>'
Tasks: TOP => assets:precompile

这是我的Gemfile:

来源'https://rubygems.org'

gem 'rails', '3.2.9'


group :development do
  gem 'sqlite3', '1.3.5'
end


group :assets do
  gem 'sass-rails',   '~> 3.2.5'
  gem 'coffee-rails', '~> 3.2.2'

  gem 'uglifier', '>= 1.2.3'
end

gem 'jquery-rails', '2.0.2'

group :production do
  gem 'pg', '0.12.2'
  gem 'thin'
end

我在Assets部分添加了所有文件,如下所示:

assets
  Folder-fancybox
    blank.gif
    fancybox_loading.gif
    fancybox_sprite.png
    jquery.fancybox.css
    jquery.fancybox.js
    jquery.fancybox.pack.js
  Folder-images
  Folder-javascripts
    application.js
    bootstrap.js
    bootstrap.min.js
    html5-3.4-respond-1.1.0.min.js
    jquery-1.8.2.js
    jquery-1.8.2.min.js
    jquery.anchor.js
    pages.js.coffee
    script.js
  Folder-stylesheets
    animate.css
    application.css
    bootstrap.css
    bootstrap.min.css
    Folder-font
      fontawesome-webfront.eot
      fontawesome-webfront.svg
      fontawesome-webfront.ttf
      fontawesome-webfront.woff
    font-awesome-ie7.css
    font-awesome.css
    pages.css.scss
    styles.css

2 个答案:

答案 0 :(得分:0)

Heroku无法处理您的样式表,因为它不希望它们处于较少的状态(请参阅http://lesscss.org/)。首先,您必须将所有样式表(或至少是LESS中的样式表)的扩展名更改为filename.css.less。然后,您需要在gemfile中包含一个LESS解析器,如下所示:

group assets do
    gem 'less-rails'
    gem 'coffee-rails', '~> 3.2.2'
    gem 'uglifier', '>= 1.2.3'
end

如果您没有使用SASS(.css.scss),那么您可能不需要sass-rails gem。您也可以使用less gem,但我不知道它与less-rails的区别。

之后它应该工作。如果没有,请尝试运行heroku run rake assets:precompile。如果它仍然无效,您可能需要将其添加到您的application.rb:

config.assets.initialize_on_precompile = false

另外,你应该看一个名为less-rails-bootstrap的宝石。它将取代你的bootstrap.min.css。如果你的主题使用LESS,那么很有可能它希望你的引导程序在LESS中也可以使用变量,mixins,函数等。

答案 1 :(得分:0)

看起来模板中可能只有一些无效的CSS。在捆绑的样式表中的某处,您为“width:;”设置了缺失值。

由于主题指定“使用少量:否”使用Bootstrap 2.2.1,HTML5 / CSS3“,我认为LESS不是问题。相反,rails会在生产中解析你的CSS以缩小它,如果有的话是任何CSS错误都会引发错误。

您可以通过预编译资产在本地重现此错误。否则,在您的开发机器上,您的资产不会经历相同的过程。