Sublime2 + SASS + Koala 测试
Sublime SASS语法高亮插件下载地址:https://github.com/kuroir/SCSS.tmbundle/zipball/SublimeText2
koala_2.0.4_setup.exe 下载地址:http://pan.baidu.com/s/1o6ktn5o
测试代码(参考阮一峰:http://www.ruanyifeng.com/blog/2012/06/sass.html)
scss.scss
/*
koala 编译scss不支持中文解决方案:
your disk:\Koala\rubygems\gems\sass-3.4.9\lib\sass
修改 engine.rb 文件
在require 最下面 加入以下代码 即可解决
Encoding.default_external = Encoding.find('utf-8')
*/ /* 导入外部scss文件 */
@import "base.scss"; /* 1.定义普通变量 */
/* 1.1 变量用作css的值*/
$blue : #1875e7;
div {
color : $blue;
} /* 1.2 变量用在css的属性名中 */
$side: left;
div {
border-#{$side}: 1px solid #ccc;
} /* 2.嵌套 */
/* 2.1 普通嵌套 */
#main {
font-size: 14px;
#nav {
font-size: 20px;
color:red;
}
.sidebar {
width: 200px;
border: 20px solid #ccc;
border-radius: 50%;
}
} /* 属性嵌套 */
#warpper{
border: {
color: $blue;
size: 1px;
#{$side}: 10px;
}
} /* 继承 */
#father {
font-size: 20px;
} #child {
@extend #father;
color:red;
} /* 重用的代码块 */
@mixin test($color:red){
color:$color;
} @mixin borderRadius($radius:5px){
border-radius: $radius;
-moz-border-radius:$radius;
-webkit-border-radius: $radius;
} #footer {
@include test(blue);
@include borderRadius(50%);
} /* 高级 */
$color: red;
p{
@if $color == red {
color: blue;
}
} /* for 循环 */
@for $i from 1 to 10{
.line-#{$i}{
border:#{$i}px #ccc solid;
}
} /* while循环 */
$i: 4;
@while $i > 0{
.line#{$i} {font-size: 4px * $i;}
$i: $i - 1; /* 注意变量前后的加空格 */
} /* each */
@each $item in top,left,bottom,right {
.#{$item} {background: url(image/#{$item}.png);}
}
base.scss
$globalfont-size:12px;
body{
font-size: $globalfont-size;
}
输出结果:
@charset "UTF-8";
/*
koala 编译scss不支持中文解决方案:
your disk:\Koala\rubygems\gems\sass-3.4.9\lib\sass
修改 engine.rb 文件
在require 最下面 加入以下代码 即可解决
Encoding.default_external = Encoding.find('utf-8')
*/
/* 导入外部scss文件 */
body {
font-size: 12px;
} /* 1.定义普通变量 */
/* 1.1 变量用作css的值*/
div {
color: #1875e7;
} /* 1.2 变量用在css的属性名中 */
div {
border-left: 1px solid #ccc;
} /* 2.嵌套 */
/* 2.1 普通嵌套 */
#main {
font-size: 14px;
}
#main #nav {
font-size: 20px;
color: red;
}
#main .sidebar {
width: 200px;
border: 20px solid #ccc;
border-radius: 50%;
} /* 属性嵌套 */
#warpper {
border-color: #1875e7;
border-size: 1px;
border-left: 10px;
} /* 继承 */
#father, #child {
font-size: 20px;
} #child {
color: red;
} /* 重用的代码块 */
#footer {
color: blue;
border-radius: 50%;
-moz-border-radius: 50%;
-webkit-border-radius: 50%;
} /* 高级 */
p {
color: blue;
} /* for 循环 */
.line-1 {
border: 1px #ccc solid;
} .line-2 {
border: 2px #ccc solid;
} .line-3 {
border: 3px #ccc solid;
} .line-4 {
border: 4px #ccc solid;
} .line-5 {
border: 5px #ccc solid;
} .line-6 {
border: 6px #ccc solid;
} .line-7 {
border: 7px #ccc solid;
} .line-8 {
border: 8px #ccc solid;
} .line-9 {
border: 9px #ccc solid;
} /* while循环 */
.line4 {
font-size: 16px;
} /* 注意变量前后的加空格 */
.line3 {
font-size: 12px;
} /* 注意变量前后的加空格 */
.line2 {
font-size: 8px;
} /* 注意变量前后的加空格 */
.line1 {
font-size: 4px;
} /* 注意变量前后的加空格 */
/* each */
.top {
background: url(image/top.png);
} .left {
background: url(image/left.png);
} .bottom {
background: url(image/bottom.png);
} .right {
background: url(image/right.png);
} /*# sourceMappingURL=scss.css.map */
Sublime2 + SASS + Koala 测试的更多相关文章
- PostCSS深入学习: PostCSS和Sass、Stylus或LESS一起使用
如果你喜欢使用PostCSS,但又不想抛弃你最喜欢的预处理器.不用担心,你不需要作出二选一的选择,你可以把PostCSS和预处理器(Sass.Stylus或LESS)结合起来使用. 有几个PostCS ...
- Ruby与sass 与compass安装
Ruby安装 windows平台下使用Rubyinstaller安装 1) 下载Rubyinstaller 2) 安装Rubyinstaller 记得勾选 add ruby executables ...
- sass 的使用
普通变量 ? 1 $fontSize:12px; 默认变量 ? 1 $fontSize:12px; !default; 变量覆盖:只需要在默认变量之前重新声明下变量即可 ? 1 2 $fontSize ...
- Sass中连体符(&)的运用
在CSS中,这种想法是无法实现的,但在Sass中,可以轻松的通过连体符&来实现.这也是我们今天要说的. 我们先来回忆一下,CSS中常见的一组样式: /*页面中链接的颜色*/ a {clolor ...
- css之px自动转rem—“懒人”必备
作为一名前端开发,尤其是在做移动端适配时,rem是我们经常用到的单位,它的好处大家可以自行搜索,网上已经有很多了.但是我们再将设计稿上的px转换成rem时,得手动的去计算,这是一个很耗时.费力的过程, ...
- python 全栈开发,Day57(响应式页面-@media介绍,jQuery补充,移动端单位介绍,Bootstrap学习)
昨日内容回顾 ajax //get post 两种方式 做 请求 get 主要是获取数据 post 提交数据 同一个路由地址 既可以是get请求也可以是post请求 一个路由对应一个函数 get请求 ...
- Sass:初识Sass与Koala工具的使用
一.下载Koala(找到合适的系统版本)并安装 二.先新建一个css文件夹,并在里面新建一个文本文档(.txt),将其命名为demo.scss 三.打开Koala,将css文件夹拽进来,可以修改一下输 ...
- Less/Sass编译工具,koala使用指南
如果你正在使用sass.less或coffee,而没有注意到koala, 那说明你可能已经好久没有更新你的知识库了.koala这个由国人编写的,用于编译sass.less.coffee利器,在最近的短 ...
- Sass、Less编译器koala及koala不支持中文字体的解决方法
一款很好用的Sass编译器,还可以编译Less.coffeescript等 去官网下载适合自己电脑的版本 http://koala-app.com/index-zh.html 打开后拖动或者打开项目目 ...
随机推荐
- DOM 属性操作
1 属性节点 2 attribute操作 3 value获取值操作 4 class的操作 5 指定CSS操作 1.属性节点 //获取文本节点的值 var divEle = document.getEl ...
- python3 中引用 HTMLTestRunner.py 模块的注意事项
HTMLTestRunner.py支持python2中运行,如果在python3.6.2中引用HTMLTestRunner.py模块,需要做一下更改: 1.更改HTMLTestRunner.py模块中 ...
- 20170401 错了两天的-XML解析
你不找到的话,错误就在那里.你找到了错误才会成为财富! Strans XML 解析3要素:1.源xml 格式正常, eg. '<?xml version="1.0" enco ...
- python基础27 -----python进程终结篇-----IO模型
一.IO模型 1.IO模型分类 1.阻塞IO--------blocking IO 2.非阻塞IO------nonblocking IO 3. 多路复用IO------- multiplexing ...
- 字符编码 and 字节和字符串转换(待补充)
ascii用一个字节(8位二进制)代表一个字符 Unicode常用2个字节(16位二进制)代表一个字符,生僻字需要用四个字节 汉字中已经超出了ASCII编码的范围,用Unicode, Unicode兼 ...
- 顽石系列:Linux基础笔试
顽石系列:Linux基础笔试 系统操作 压缩文件 扩展名 压缩程序 *.Z compress *.zip zip *.gz gzip *.bz2 bzip2 *.xz xz *.tar tar 程序打 ...
- 关于IDEA导出项目jar包/runnable jar
将项目导出为jar包分为 runnable jar 与 普通jar包 一.导出为普通jar包 该jar包中只有项目源代码, java -cp wordcount.jar 用来运行普通jar包 1.打开 ...
- WEB网页专业词汇 汇总
Accessibility 可访问性 accessor properties 存取器属性 addition 加法 aggregate 聚合 alphabetical order 字母表顺序 Anch ...
- json教程系列(2)-生成JSONObject的方法
生成JSONObject一般有两种方式,通过javabean或者map类型来生成.如下面的例子: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 2 ...
- 最新版express使用时的变化
原文:http://www.unfish.net/archives/772-20131207.html 很幸运地找到这篇文章,里面的内容讲的非常的细,对于开始着手搭建项目的我来说特别有用.但文中的部分 ...