最近想學(xué)習(xí)下Bootstrap,因?yàn)楸旧碜约阂苍谟肧ASS寫CSS,所以想裝一個(gè)基于SASS的Bootstrap,在Bootstrap中文網(wǎng)看中文文檔下載了一個(gè)SASS項(xiàng)目源碼,一開始看Bootstrap3的中文文檔,比較困惑于Less版和SASS版的差別,安裝區(qū)別很大,下了SASS項(xiàng)目的源碼也不知道怎么進(jìn)行安裝,看了SASS說明文檔第2步安裝方法:Compass without Rails,
用Ruby安裝方法試了下挺簡(jiǎn)單,也不用提前下載源碼.
1. 先設(shè)置RubyGems 鏡像
因?yàn)閲?guó)內(nèi)網(wǎng)絡(luò)原因?qū)е掠胓em安裝的時(shí)候都有網(wǎng)絡(luò)問題,
更改gem源到淘寶的gem的鏡像源:
$ gem sources --remove https://rubygems.org/
$ gem sources -a https://ruby.taobao.org/
$ gem sources -l
*** CURRENT SOURCES ***
https://ruby.taobao.org
# 請(qǐng)確保只有 ruby.taobao.org
$ gem install rails
2. 安裝bootstrap-sass
$ gem install bootstrap-sass
3. 安裝Compass
$ gem install Compass
4. 創(chuàng)建新的項(xiàng)目
現(xiàn)在可以正常創(chuàng)建Bootstrap 項(xiàng)目了
$ compass create my-new-project -r bootstrap-sass --using bootstrap
上面命令會(huì)創(chuàng)建一個(gè)項(xiàng)目,同時(shí)提示以下內(nèi)容:
Congratulations! Your compass project has been created.
You may now add and edit sass stylesheets in the sass subdirectory of your project.
Sass files beginning with an underscore are called partials and won't be
compiled to CSS, but they can be imported into other sass stylesheets.
You can configure your project by editing the config.rb configuration file.
You must compile your sass stylesheets into CSS when they change.
This can be done in one of the following ways:
1. To compile on demand:
compass compile [path/to/project]
2. To monitor your project for changes and automatically recompile:
compass watch [path/to/project]
More Resources:
* Website: http://compass-style.org/
* Sass: http://sass-lang.com
* Community: http://groups.google.com/group/compass-users/
To import your new stylesheets add the following lines of HTML (or equivalent) to your webpage:
<head>
<link href="/stylesheets/styles.css" rel="stylesheet" type="text/css" />
</head>
現(xiàn)在可以開心的學(xué)習(xí)測(cè)試bootstrap-sass了~~~