sass和compass安装

安装Sass和Compass

sass基于Ruby语言开发而成,所以安装sass前须要安装Ruby(注:mac下自带Ruby无需在安装Ruby!)css

window下安装SASS首先须要安装Ruby,先从官网下载Ruby并安装。安装过程当中请注意勾选Add Ruby executables to your PATH添加到系统环境变量。以下图:html

安装完成后需测试安装有没有成功,运行CMD输入如下命令:sass

ruby -v //如安装成功会打印 ruby 2.2.2p95 (2015-04-13 revision 50295) [i386-mingw32] 

如上已经安装成功。但由于国内网络的问题致使gem源间歇性中断所以咱们须要更换gem源。(使用淘宝的gem源https://ruby.taobao.org/)以下:ruby

//1.删除原gem源 gem sources --remove https://rubygems.org/ //2.添加国内淘宝源 gem sources -a https://ruby.taobao.org/ //3.打印是否替换成功 gem sources -l //4.更换成功后打印以下 *** CURRENT SOURCES *** https://ruby.taobao.org/ 

Ruby自带一个叫作RubyGems的系统,用来安装基于Ruby的软件。咱们能够使用这个系统来 轻松地安装SassCompass。要安装最新版本的SassCompass,你须要输入下面的命令:网络

//安装以下(如mac安装遇到权限问题需加 sudo gem install sass) gem install sass gem install compass 

在每个安装过程当中,你都会看到以下输出:测试

Fetching: sass-3.x.x.gem (100%)
Successfully installed sass-3.x.x
Parsing documentation for sass-3.x.x
Installing ri documentation for sass-3.x.x
Done installing documentation for sass after 6 secon
1 gem installed

安装完成以后,你应该经过运行下面的命令来确认应用已经正确地安装到了电脑中:spa

sass -v Sass 3.x.x (Selective Steve) compass -v Compass 1.x.x (Polaris) Copyright (c) 2008-2015 Chris Eppstein Released under the MIT License. Compass is charityware. Please make a tax deductable donation for a worthy cause: http://umdf.org/compass 

以下sass经常使用更新、查看版本、sass命令帮助等命令:code

//更新sass gem update sass //查看sass版本 sass -v //查看sass帮助 sass -h