3:sass的安装
首先安装ruby
ruby版本检查:ruby -v
gem版本检查:gem -v
gem类似于node里面的npm,是ruby的安装包管理器,利用gem来安装sass
sass安装
gem install sass
sass 测试版安装
gem install sass --pre
sass卸载
gem uninstall sass
sass更新
gem update sass
sass版本查看
sass -v
sass帮助
sass -h
由于众所周知的原因,我们可能安装不成功,这时候我们可以利用淘宝RubyGems镜像来安装sass
第一步:检查默认的源:gem sources l
返回结果:
*** CURRENT SOURCES ***
https://rubygems.org/
第二步:移除默认的源:gem sources --remove https://rubygems.org/
返回结果:
https://rubygems.org/ removed from sources
第三步:检查默认的源:gem sources l
返回结果:
*** CURRENT SOURCES ***
第四步:添加淘宝的源:gem sources -a https://ruby.taobao.org/
返回结果:
Error fetching https://ruby.taobao.org:
SSL_connect returned=1 errno=0 state=SSLv3 read server certificate B: ce
rtificate verify failed (https://rubygems-china.oss-cn-hangzhou.aliyuncs.com/spe
cs.4.8.gz)
分析:好像该地址是缺少gem,更换淘宝的源地址:改为:http://gems.ruby-china.org/
第五步:添加淘宝的源:gem sources -a http://gems.ruby-china.org/
返回结果:
http://gems.ruby-china.org/ added to sources
第五步:检查默认的源:gem sources l
返回结果:
*** CURRENT SOURCES ***
http://gems.ruby-china.org/
第六步:安装sass,gem install sass
返回结果:
Fetching: sass-3.4.22.gem (100%)
Successfully installed sass-3.4.22
Parsing documentation for sass-3.4.22
Installing ri documentation for sass-3.4.22
Done installing documentation for sass after 7 seconds
1 gem installed
第七步:检查sass:sass -v
返回结果:
Sass 3.4.22 (Selective Steve)
最后在执行一遍:gem sources -a https://rubygems.org/;把默认的源在添加进去