Trying to setup Susy grid with Rails 4

眉间皱痕 提交于 2019-12-11 11:09:22

问题


I want to use susy with Rails 4.

I added gem 'susy' to my gemfile. Then I run bundle install. Everything is fine and says the gem was installed. Now I restart my Rails server, and add @import "susy"; to application.css.scss (I'm using sprockets).

I get the error File to import not found or unreadable: susy. Any ideas?


回答1:


To the best of my understanding, Sass-Rails is still using an older version of Sass that does not support Susy 2. I hope they are working on an update, and have it available soon. In the meantime, you will have to use Susy 1.0. That also means using Compass, and adding require "susy" to your config.rb.




回答2:


Here's an update for those of you trying to use Compass, Susy 2 and Rails 4.1. This would probably work with other versions of Rails but I haven't tested. Please note that I've only done preliminary testing and you'll be using a beta version of sass-rails so use at your own risk.

In your Gemfile:

gem 'sass-rails', '5.0.0.beta1' # This is the important bit since it supports Sass 3.3    
gem 'susy'
gem 'compass-rails', '~> 2.0.0'

In your application.rb:

...
require 'rails/all'
require 'susy'
...

In your stylesheet:

@import 'compass';
@import 'susy';

.container { @include container; }
...

Link to issue: https://github.com/ericam/susy/issues/339



来源:https://stackoverflow.com/questions/23440534/trying-to-setup-susy-grid-with-rails-4

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!