I haven't made any changes to my assets and now all of a sudden when I perform a git push heroku master it aborts on rake assets:precompile

...

Preparing app for Rails asset pipeline
Running: rake assets:precompile
I, [2014-03-14T18:30:05.776041 #675]  INFO -- : Writing /tmp/build_f664cf41-71b7-435d-b85e-8f607080a4d3/public/assets/application-0a41bdbc9b8fc13f1e62a69634eb2c98.js
rake aborted!
wrong number of arguments (2 for 1)
(in /tmp/build_f664cf41-71b7-435d-b85e-8f607080a4d3/app/assets/stylesheets/application.css.scss)
/tmp/build_f664cf41-71b7-435d-b85e-8f607080a4d3/vendor/bundle/ruby/2.0.0/gems/sass-3.2.14/lib/sass/importers/filesystem.rb:16:in `initialize'
/tmp/build_f664cf41-71b7-435d-b85e-8f607080a4d3/vendor/bundle/ruby/2.0.0/gems/sprockets-2.12.0/lib/sprockets/sass_importer.rb:11:in `initialize'

...

Tasks: TOP => assets:precompile
(See full trace by running task with --trace)
!
!     Precompiling assets failed.
!

!     Push rejected, failed to compile Ruby app

It looks like it's breaking on wrong number of arguments (2 for 1) in assets/stylesheets/application.css.scss. But I don't have any methods in my stylesheets. Here's that file:

/*
* This is a manifest file that'll be compiled into application.css, which will include all the files
* listed below.
*
* Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets,
* or vendor/assets/stylesheets of plugins, if any, can be referenced here using a relative path.
*
* You're free to add application-wide styles to this file and they'll appear at the top of the
* compiled file, but it's generally better to create a new file per style scope.
*
*= require_self
*= require_tree .
*/

In my assets/stylesheets/custom.css.scss I have this at the top:

@import 'bootstrap';
@import 'bootstrap-responsive';

In my config/application.rb file I have:

config.assets.precompile += %w(*.png *.jpg *.jpeg *.gif)
config.assets.initialize_on_precompile = false

I've performed a heroku run rake assets:clobber and that didn't help.

Locally my app works and functions perfectly fine.

Here's some Gems I'm using for reference:

gem 'sass-rails'
gem 'bootstrap-sass', '2.3.2.0'
gem 'rails_12factor'
gem 'compass_rails'
gem 'jquery-rails'
gem 'rails', '4.0.2'

Any ideas?

有帮助吗?

解决方案

Ok. I found out the problem.

gem 'sass-rails' was using version 3.2.14. By updating to 4.0.2 I was able to precompile my assets while deploying to Heroku.

All is well.

其他提示

Just add/modify Gemfile dependecy sass-rails like this

gem 'sass-rails', '4.0.2'

That modification solved the problem in my case.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top