前言:Sass is an extension of CSS that adds power and elegance to the basic language. It allows you to use variablesnested rulesmixinsinline imports, and more, all with a fully CSS-compatible syntax. Sass helps keep large stylesheets well-organized, and get small stylesheets up and running quickly, particularly with the help of the Compass style library.——《摘自sass官方文档》

  所以我们使用sass+compass组合。(本文只讲windows环境,因为工作电脑是WIN)

  1、ruby环境安装

  sass依赖ruby环境,官网(http://rubyinstaller.org/downloads/)下载合适的版本的ruby,安装时注意在选择路径的那一步勾选Add Ruby executables to your PATH.

  2、sass安装

  在菜单中打开Start Command Prompt with Ruby,运行命令来安装sass:

gem install sass   //安装sass
sass -v //查看sass版本号
sass -h //查看sass命令

  3、compass安装

gem install compass  //安装compass
compass version //查看compass版本号

  基本环节配置好之后就可以小试身手了。

  4、启动项目

compass create <myproject>

  会生成一个名为<myprject>的文件夹,目录结构如下:

  5、编译

  compass是懒编译——只编译有改动的文件。

compass compile //手动编译sacc文件为css文件
compass watch //监控scss文件,有改动的时候自动编译为css

  剩下的事情就是熟悉sacc语法及compass的各大模块,compass之于css就像jquery之于javascript,了解sacc基本语法之后,使用compass来干活,事半功倍。

附录:

1、compass基本命令:

Primary Commands:
* clean - Remove generated files and the sass cache
* compile - Compile Sass stylesheets to CSS
* create - Create a new compass project
* init - Add compass to an existing project
* watch - Compile Sass stylesheets to CSS when they change
Other Commands:
* config - Generate a configuration file for the provided command line options.
* extension - Manage the list of compass extensions on your system
* frameworks - List the available frameworks
* help - Get help on a compass command or extension
* imports - Emit an imports suitable for passing to the sass command-line.
* install - Install an extension's pattern into your compass project
* interactive - Interactively evaluate SassScript
* sprite - Generate an import for your sprites.
* stats - Report statistics about your stylesheets
* unpack - Copy an extension into your extensions folder.
* validate - Validate your generated css.
* version - Print out version information

2、sacc中文文档http://sass.bootcss.com/docs/sass-reference/

3、compass官方文档http://compass-style.org/reference/compass/support/

sass+compass起步的更多相关文章

  1. sass+compass+bootstrap三剑合璧高效开发记录

    1. 先搭建环境,下载node.js,rubyinstaller,安装, 安装rubyinstaller时,要选上include system path,这样就会自动将node.js执行添加到wind ...

  2. window 安装 sass compass 记录

    1.安装Ruby 安装sass 和compass 需要 Ruby 的环境,还区分xp 和win7-8 下版本区别 ruby 官网中文 ruby 官网英文 注意: xp: 下载 [xp不能下载包含64位 ...

  3. windows下的SASS/Compass的安装与卸载

    认识SASS/Compass SASS是一种CSS的开发工具,提供了许多便利的写法,大大节省了设计者的时间,使得CSS的开发,变得简单和可维护. SASS与Compass的安装说明 SASS在Wind ...

  4. SASS+COMPASS 自适应 学习笔记

    来源 http://snugug.github.io/RWD-with-Sass-Compass/#/ 1 安装 COMPASS 扩展 安装 方式 gem 'extension', '~>X.Y ...

  5. sass&compass&grunt

    1. compass compile path/to/project//编译scss compass watch path/to/project//自动监视文件变化 2.mixin @include ...

  6. sass,compass让开发效率飞起

    最近开始学习并且使用,发现使用它写起css来真的是各种爽 安装sass,compass sass是依赖于ruby的,必须先安装Ruby,点击下载 下载完ruby之后,使用命令行安装sass       ...

  7. 我给自己的Sass+Compass,在Windows下写个bat,快速cd到我的sass目录

    在Windows下,我总是要打开Ruby的cmd来进行Sass,其中要写好多cd,次数多了,自己的多敲,的确能记得更牢靠,但是无形中会浪费自己的一点点敲cd命令的时间,所以我想到自己在windows下 ...

  8. sass compass config.rb

    require 'compass/import-once/activate' # Require any additional compass plugins here. # Set this to ...

  9. 强悍的CSS工具组合:Blueprint, Sass, Compass

    掌握CSS是每个Web开发者的基本要求,虽然CSS本身并不复杂,但怎样写出支持所有主流浏览器(特别是IE)的CSS,以及在大型网站中如何有序地组织好CSS结构却是一个相当棘手的问题.我更多的是一个开发 ...

随机推荐

  1. throw 、throws 简介

    抛出异常抛出异常有三种形式,一是throw,一个throws,还有一种系统自动抛异常.下面它们之间的异同.系统自动抛异常当程序语句出现一些逻辑错误.主义错误或类型转换错误时,系统会自动抛出异常.如: ...

  2. VK Cup 2016 - Round 1 (Div. 2 Edition) C. Bear and Forgotten Tree 3

    C. Bear and Forgotten Tree 3 time limit per test 2 seconds memory limit per test 256 megabytes input ...

  3. iOS--控制器加载自定义view的xib

    我们在项目中,经常需要使用到自定义的view,而xib布局显得更为简洁,那么如何加载一个自定义的xib呢,网上的方法也很多很多,就是因为太多了,我经常会弄混,所以总结其中一个使用,如果以后使用到其他的 ...

  4. maven实战(7)-- 设置maven编译器级别

    两种方式: (一)全局设置 首先我们要在settings.xml文件中找到<profiles>标签,然后在此标签内部粘贴如下配置: <profile> <id>jd ...

  5. SPOJ:House Fence(分治&DP)

    "Holiday is coming, holiday is coming, hurray hurray!" shouts Joke in the last day of his ...

  6. NOIP2007 矩阵取数游戏(区间DP)

    传送门 这道题第一眼看上去可能让人以为是贪心……不过贪心并不行,因为每次的操作是有2的幂次方的权值的.这样的话直接每次贪心最小的就目光短浅.所以那我们自然想到了DP. 据说这是一道很正常的区间DP? ...

  7. Watir: 如果安装sougou浏览器,有可能导致Watir不能工作

    如果安装了搜狗,Watir::Browser.new并不一定能打开新的IE浏览器.这种情况下,必须卸载搜狗浏览器,当然,attach,find方法还是可以用的

  8. CreateThread创建线程 互斥量锁

    HANDLE CreateThread( LPSECURITY_ATTRIBUTES lpThreadAttributes,//SD:线程安全相关的属性,常置为NULL SIZE_T dwStackS ...

  9. (二十五)后台开发-分类信息的curd -展示所有实现

    案例1-分类信息的curd 步骤分析: 左边的dtree: 1.导入dtree.js 2.导入dtree.css 3.创建一个div 添加样式 class="dtree" 4.在d ...

  10. UVaLive 6588 && Gym 100299I (贪心+构造)

    题意:给定一个序列,让你经过不超过9的6次方次操作,变成一个有序的,操作只有在一个连续区间,交换前一半和后一半. 析:这是一个构造题,我们可以对第 i 个位置找 i 在哪,假设 i  在pos 位置, ...