开始学习Bootstrap

最近想学习下Bootstrap,因为本身自己也在用SASS写CSS,所以想装一个基于SASS的Bootstrap,在Bootstrap中文网看中文文档下载了一个SASS项目源码,一开始看Bootstrap3的中文文档,比较困惑于Less版和SASS版的差别,安装区别很大,下了SASS项目的源码也不知道怎么进行安装,看了SASS说明文档第2步安装方法:Compass without Rails,
用Ruby安装方法试了下挺简单,也不用提前下载源码.

1. 先设置RubyGems 镜像

因为国内网络原因导致用gem安装的时候都有网络问题,
更改gem源到淘宝的gem的镜像源:

$ gem sources --remove https://rubygems.org/
$ gem sources -a https://ruby.taobao.org/
$ gem sources -l
*** CURRENT SOURCES ***

https://ruby.taobao.org
# 请确保只有 ruby.taobao.org
$ gem install rails

2. 安装bootstrap-sass

$ gem install bootstrap-sass

3. 安装Compass

$ gem install Compass

4. 创建新的项目

现在可以正常创建Bootstrap 项目了

$ compass create my-new-project -r bootstrap-sass --using bootstrap

上面命令会创建一个项目,同时提示以下内容:

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>

现在可以开心的学习测试bootstrap-sass了~~~

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容

  • 想想学习Sass时间也有差不多一年的光景了。在这一年来的时间中,在GitHub不断阅读Sass相关的源码。也在国外...
    小豌豆书吧阅读 12,027评论 1 24
  • Bootstrap是什么? 一套易用、优雅、灵活、可扩展的前端工具集--BootStrap。GitHub上介绍 的...
    凛0_0阅读 13,728评论 3 184
  • 活得不好,就会去怀念前任。
    Linkkk_阅读 858评论 0 1
  • 这周我们读的书是《非暴力沟通》,我主要学到了一下几点: 1 掌控情绪 发脾气谁都会,控制住不发脾气是本事。 人有七...
    阿鹏船长阅读 2,586评论 1 2