Does compass-rails support Ruby on Rails 4.0?

后端 未结 6 452
死守一世寂寞
死守一世寂寞 2020-12-28 14:19

I have clean new Rails 4 app with Gemfile:

#default gems
gem \'compass-rails\'
gem \'zurb-foundation\'
gem \'thin\'

with style.scss:

<
相关标签:
6条回答
  • 2020-12-28 14:24

    It appears that as of this time (06/29/2013) compass-rails does not support Rails 4. When I run

    rails generate foundation:install
    

    I get the error message below.

    Unsupported rails environment for compass
    
    0 讨论(0)
  • 2020-12-28 14:28

    Compass needs to have some key parts rewritten in order to support Rails 4. There is a temporary branch you can use that has hacked together some support:

    'gem "compass-rails", github: "milgner/compass-rails", ref: "1749c06f15dc4b058427e7969810457213647fb8"

    You can follow https://github.com/Compass/compass-rails/pull/59 for the latest updates.

    Update:

    There is now a version in alpha.

    gem "compass-rails", "~> 2.0.alpha.0"

    Update 2: compass-rails is no longer in alpha.

    Add the following to your Gemfile and type bundle install.

    gem "compass-rails", "~> 1.1.2"
    
    0 讨论(0)
  • 2020-12-28 14:30

    I ended up using the alpha version suggested by Sunny Juneja.

    But to make it work I had to remove the assets group from my gemfile:

    # Not working:
    group :assets do       # remove me olde line
       gem 'sass-rails',   '~> 4.0.0'
       gem 'compass-rails' # specify me version
    end                    # remove me too, says aye
    
    # Working:
    gem 'sass-rails',    '~> 4.0.0'
    gem 'compass-rails', '~> 2.0.alpha.0'
    
    0 讨论(0)
  • 2020-12-28 14:32

    As of about 18 hours ago, the stable branch of compass-rails supports Rails 4. Remove the version string "2.0.alpha.0" from compass-rails in your Gemfile and run bundle update.

    Here's the commit history:

    https://github.com/Compass/compass-rails/commits/stable

    0 讨论(0)
  • 2020-12-28 14:37

    I added all of the compass files to my vendor folder and it worked =), this may not be the preferable option for much longer =(.

    0 讨论(0)
  • 2020-12-28 14:46

    Try this:

    gem 'sass-rails'
    gem 'compass-rails', github: 'Compass/compass-rails'
    

    You should also make sure these are NOT included inside your asset group, since it has been removed from Rails 4.0.

    Then remove your Gemfile.lock file and regenerate it using the bundle command.

    rm Gemfile.lock
    bundle
    
    0 讨论(0)
提交回复
热议问题