1 -> gem -v 2 2.0.14 3 4 -> sudo gem install sass 5 6 -> sass -v 7 Sass 3.4.13 (Selective Steve)
sudo gem install sass时出现错误
1. ERROR: Could not find a valid gem 'sass' (>= 0), here is why:
Unable to download data from https://rubygems.org/ - Errno::ETIMEDOUT: Operation timed out - connect(2) (https://rubygems.org/latest_specs.4.8.gz)
原因:被和谐了
解决:更改ruby源
1 -> gem sources 2 https://rubygems.org/ 3 -> gem sources --remove https://rubygems.org/ 4 -> gem sources --a https://ruby.taobao.org/
2. ERROR: While executing gem ... (NoMethodError) undefined method `size' for nil:NilClass
原因:缓存问题
解决:clear gem cache
1 -> cd /Library/Ruby/Gems/2.0.0/cache 2 -> sudo rm sass-3.4.13.gem
1 -> gem install bootstrap-sass -v 3.3.2.0 2 -> cd /Library/Ruby/Gems/2.0.0/gems/bootstrap-sass-3.3.2.0/assets/stylesheets
bootstrap with sass相关文件在stylesheets文件夹下,拷贝到自己项目下使用即可;如下图所示。PS:我把stylesheets改名成了bootstrapSass :)
<最重要的事项开头说>Sass编译输出css
1 -> sass sample.scss output.css
如开篇所说Sass是CSS的扩展语言,其提供了变量定义、函数定义、函数调用、类继承、嵌套(CSS层级关系)及代码引入功能,下面逐一介绍其功能用法。
sample.scss
1 $border-radius-base: 4px !default;
sample.scss
1 @mixin border-left-radius($radius) { 2 border-bottom-left-radius: $radius; 3 border-top-left-radius: $radius; 4 }
sample.scss