markdown 让Compass工作,这样我就可以在旧网站上编译SCSS

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了markdown 让Compass工作,这样我就可以在旧网站上编译SCSS相关的知识,希望对你有一定的参考价值。

Holy crap, what a saga. And it might get re-enacted for every old site... :P

So the version of Ruby that Apple installs with the system inevitably becomes outdate. Also, you have to use sudo to install gems. Far better to install the most recent stable version of Ruby using the Ruby Version Manager :)

### Install rvm
I basically followed this [How to Install Ruby on Mac OS X with RVM](https://usabilityetc.com/articles/ruby-on-mac-os-x-with-rvm/) tutorial... ([evernote backup](https://www.evernote.com/shard/s10/nl/1179736/9d7974dc-bab7-4597-b179-bed1a2af3783)) and installed the latest stable version of ruby.

### In the teensource theme

I navigated to the site's theme file and saw a Gemfile. So I ran `bundle install`. Which ran and installed a bunch of stuff... and then **failed** when it hit the `Installing yajl-ruby 1.2.1 with native extensions` step!
```
Installing yajl-ruby 1.2.1 with native extensions
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.

    current directory: /Users/noxlady/.rvm/gems/ruby-2.4.5/gems/yajl-ruby-1.2.1/ext/yajl
/Users/noxlady/.rvm/rubies/ruby-2.4.5/bin/ruby -r ./siteconf20190228-23925-p3lc6m.rb extconf.rb
creating Makefile

current directory: /Users/noxlady/.rvm/gems/ruby-2.4.5/gems/yajl-ruby-1.2.1/ext/yajl
make "DESTDIR=" clean

current directory: /Users/noxlady/.rvm/gems/ruby-2.4.5/gems/yajl-ruby-1.2.1/ext/yajl
make "DESTDIR="
compiling yajl.c
compiling yajl_alloc.c
compiling yajl_buf.c
compiling yajl_encode.c
compiling yajl_ext.c
yajl_ext.c:42:19: warning: implicit conversion loses integer precision: 'long' to 'int' [-Wshorten-64-to-32]
        int len = RARRAY_LEN(wrapper->builderStack);
            ~~~   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Users/noxlady/.rvm/rubies/ruby-2.4.5/include/ruby-2.4.0/ruby/ruby.h:1026:23: note: expanded from macro 'RARRAY_LEN'
#define RARRAY_LEN(a) rb_array_len(a)
...
a bunch more of the same warnings...
...

yajl_ext.c:881:22: error: use of undeclared identifier 'rb_cFixnum'
    rb_define_method(rb_cFixnum, "to_json", rb_yajl_json_ext_fixnum_to_json, -1);
                     ^
17 warnings and 1 error generated.
make: *** [yajl_ext.o] Error 1

make failed, exit code 2

Gem files will remain installed in /Users/noxlady/.rvm/gems/ruby-2.4.5/gems/yajl-ruby-1.2.1 for inspection.
Results logged to /Users/noxlady/.rvm/gems/ruby-2.4.5/extensions/x86_64-darwin-18/2.4.0/yajl-ruby-1.2.1/gem_make.out

An error occurred while installing yajl-ruby (1.2.1), and Bundler cannot continue.
Make sure that `gem install yajl-ruby -v '1.2.1' --source 'https://rubygems.org/'` succeeds before bundling.

In Gemfile:
  yajl-ruby
```

I tried using Compass anyhow, thinking maybe... But it failed when it got to the part requiring yajl-ruby :(

I googled the error and found this GitHub issue: [Can't compile with Ruby 2.4.0 #170](https://github.com/brianmario/yajl-ruby/issues/170) which mentioned that 
>"yajl-ruby 1.3.0 added support for ruby 2.4.0"

So I opened up the gemfile.lock and changed `yajl-ruby (1.2.1)` to `yajl-ruby (1.3.0)`. I ran `bundle install` again, and this time it worked!

### In the GRID theme

Here, the bundle install crashed and burned when it hit eventmachine 1.0.3. I edited the Gemfile.lock and increased the version to 1.0.4   

Next it hung on yajl-ruby (1.1.0), which looks familiar! I changed `yajl-ruby (1.1.0)` to `yajl-ruby (1.3.0)` and ran `bundle install` one last time. 

*** 
Ugh -- I deleted and recloned the GRID site and am having nothing but problems. In addition to the previous fixes, I needed to `bundle update susy` so susyone was available to @import.

以上是关于markdown 让Compass工作,这样我就可以在旧网站上编译SCSS的主要内容,如果未能解决你的问题,请参考以下文章

由于版本冲突,无法安装 sass + compass + susy

sass,compass让开发效率飞起

Android Compass指向我的位置而不是北

Android Compass 指向我的位置而不是北

@import bootstrap-sass 不工作

Ruby Compass 编译器不工作,在线错误 [54]