家门不幸是什么意思| 医保报销是什么意思| 纯粹是什么意思| 榴莲不可以和什么食物一起吃| 晕车吃什么| 蜂蜜对人体有什么好处和功效| 吃芒果不能和什么一起吃| 嘴馋是什么意思| 结膜炎是什么病| 血糖低是什么原因引起的| 天津五行属什么| 梦见蛇是什么征兆| 舌根部淋巴滤泡增生吃什么药| 脚后跟痛是什么问题| 咽干是什么原因| 什么叫阳虚| 阑尾在什么位置| 萧何字什么| 沦丧是什么意思| 新生儿干呕是什么原因| 肺实性结节是什么意思| 九二共识是什么意思| 横眉冷对是什么意思| 什么叫失眠| 国行是什么意思| 凭什么是什么意思| 什么是性骚扰| 嗜酸性粒细胞偏低是什么意思| 宫颈癌做什么检查| 12月11号是什么星座| 胎监不过关是什么原因| 脑供血不足吃什么药好| 大明湖畔的夏雨荷是什么意思| 曼秀雷敦属于什么档次| 什么都想吃| 球蛋白偏高是什么原因| 为什么白天尿少晚上尿多| 甲午五行属什么| 糖耐主要是检查什么| uhd是什么意思| fasola是什么品牌| 电影下映是什么意思| 肠胃炎是什么引起的| 什么样的人容易高反| 化疗后吃什么补白细胞| 天丝是什么面料| 突然头晕恶心是什么原因| 易烊千玺什么星座| 一黑一白是什么蛇| 小ck是什么牌子| 感冒虚弱吃什么食物好| 什么叫临床医学| 讥讽的笑是什么笑| 喉咙沙哑吃什么药| 三八妇女节是什么生肖| 相亲第一次见面送什么礼物好| 低密度脂蛋白高的原因是什么| 吸狗是什么意思| 荷花什么时候种植| 女人为什么会宫外怀孕| a型血和b型血生的孩子是什么血型| 北京居住证有什么用| 晚上为什么不能剪指甲| 低压高用什么药| 小便发黄是什么原因| 黄金五行属什么| 最大的沙漠是什么| 猫驱虫药什么牌子好| 恩字五行属什么| 簸箕是什么意思| 哪吒代表什么生肖| 什么蛋营养价值最高| 罗勒叶在中国叫什么| 乳房检查挂什么科| 米肉是什么| 鲁迅是著名的什么家| 射手座是什么星象| 喝鲜牛奶有什么好处和坏处| 七宗罪都是什么| 儿童长倒刺缺什么营养| 驿站什么意思| cc是什么| 什么叫负氧离子| 咳嗽发烧是什么原因| 喉炎吃什么药效果最好| 肾囊肿是什么原因引起的| 化疗后吃什么增强免疫力| 为什么睡觉会出汗| 心热是什么原因造成的| 惊恐症是什么病| 眩晕是什么症状| 什么样的孙悟空| 4月8日是什么星座| 二氧化碳低是什么原因| 50岁今年属什么生肖| 什么门永远关不上| 实诚是什么意思| 忠心不二是什么生肖| 脸颊两边长痘痘是什么原因引起的| rap是什么意思| 口干舌燥是什么原因引起的| 通讯地址填什么| 塑料是什么垃圾| 外阴瘙痒用什么药| 温水煮青蛙什么意思| 喉咙干是什么病的前兆| 太阳是什么| 猴和什么相冲| 虎鼠不结亲是什么意思| 涵字属于五行属什么| 女生肚脐眼下面疼是什么原因| 预科班是什么意思| 做人流挂什么科| 香港有什么东西值得买| 数不胜数的胜是什么意思| 什么是荠菜| evol是什么意思| 什么牌子的笔记本电脑好| 未来的未多一横念什么| 真菌感染是什么| 血糖偏高吃什么水果好| 鸡炖什么补气血| 静息心率是什么意思| 付字五行属什么| 肚子胀气吃什么好| 心率低吃什么药最好| 火箭军是干什么的| 甲状腺结节用什么药| 鼠和什么属相最配对| 蟹黄是螃蟹的什么东西| 头晕是什么情况| 是什么为什么怎么办| 出水芙蓉是什么意思| 金目念什么| 仕女图是什么意思| 醉是什么生肖| 提手旁的字有什么| 献血证有什么用| 牙周袋是什么| 过敏输液输什么药好| 蘑菇什么季节长出来| 处女女和什么星座最配| 夜间睡觉出汗是什么原因| 左眉毛上有痣代表什么| 妖是什么意思| 多愁善感的动物是什么生肖| 每天吃葡萄有什么好处和坏处| 怀孕40天有什么症状| 今年是什么命| 很困但是睡不着是什么原因| 吃什么提高免疫力和增强体质| 阴湿是什么病| 类风湿为什么反复发烧| 手淫过度会导致什么| 洋红色是什么颜色| 蓝脸的窦尔敦盗御马是什么歌| 意守丹田是什么意思| 排骨汤里放什么食材好| 有利有弊是什么意思| 世界上有什么花| 怀孕初期能吃什么不能吃什么| 赴汤蹈火的汤是什么意思| 安欣是什么电视剧| 衣原体阴性是什么意思| 脚疼是什么原因| 戴帽子是什么意思| 起痱子是什么原因| 大专跟本科有什么区别| 什么的后羿| 被毒蛇咬了有什么症状| zutter是什么意思| 什么原因导致缺钾| 什么时候入梅| 出痧是什么意思| 梦寐以求是什么意思| 身正不怕影子斜是什么意思| peter是什么意思| 礽是什么意思| 肝部有阴影一般都是什么病| 窈窕淑女是什么生肖| 炁读什么| 受戒是什么意思| 生小孩需要准备什么| 叶酸是什么| 动卧是什么意思| 上面一个日下面一个立是什么字| 尿液结晶是什么意思| 血容量不足是什么意思| 非文念什么| 补体c3偏高说明什么| 耳朵响是什么原因| 蜂蜜为什么会结晶| 什么是种植牙| 江河日下是什么意思| 工作效率是什么意思| 酵母是什么东西| 甘胆酸是查什么的| cin3是什么意思| 梦到下雨是什么意思| 耳朵里面痒用什么药| 为什么去香港还要通行证| KTV服务员主要做什么| 六味地黄丸适合什么人吃| 早晨嘴苦是什么原因引起的| 特需病房是什么意思| 什么叫封闭针| 收官是什么意思| 热锅凉油是什么意思| 什么是离子| 农历十月是什么星座| 政治庇护是什么意思| 脚气用什么药膏| 海胆是什么东西| 动物蛋白是什么| 1.17是什么星座| 注意地看的词语是什么| 芥蒂什么意思| 嗜血综合症是什么病| 弥勒佛为什么是未来佛| 为什么喜欢一个人| 爱思是什么| 木危读什么| 乌江鱼是什么鱼| 50岁属什么| 口酸吃什么药| 牙出血什么原因| 桃李满天下什么意思| 透明质酸钠是什么东西| 向日葵代表什么生肖| 乳头湿疹用什么药| 湿疹用什么药| 女人耳鸣是什么前兆| 什么叫慢性非萎缩性胃炎| 酒店尾房是什么意思| 胆结石能吃什么水果| 沉沦是什么意思| 胃病挂什么科| 1024是什么星座| 私通是什么意思| 观音菩萨什么生肖| 6月6日是什么日子| 猫吃什么食物除了猫粮| 胆固醇高吃什么| 强化灶是什么意思| 同化是什么意思| 拔完智齿吃什么| mk是什么意思| 香片属于什么茶| 突然间头晕是什么原因| 转氨酶高吃什么药最好| 舌苔厚黄是什么病| 强迫症有什么症状| 农历四月是什么月| 大象是什么颜色| 吃红苋菜有什么好处| 检查脑袋应该挂什么科| 月经发黑是什么原因| 苋菜与什么食物相克| 肾结石可以吃什么食物| 桑葚酒有什么功效| 结婚28年是什么婚| 脚出汗是什么原因| 支原体和衣原体有什么区别| 反常是什么意思| 百度Jump to content

全国高端智库理事会副理事长尹汉宁一行考...

From Wikipedia, the free encyclopedia
(Redirected from Sass (stylesheet language))
Sass
Designed byHampton Catlin
DeveloperNatalie Weizenbaum, Chris Eppstein
First appearedNovember 28, 2006; 18 years ago (2025-08-06)
Stable release
1.89.1[1] / May 31, 2025; 58 days ago (2025-08-06)[1]
Typing disciplineDynamic
OSCross-platform
LicenseMIT License
Filename extensions.sass, .scss
Websitesass-lang.com
Major implementations
Dart
Influenced by
CSS (both "indented" and SCSS) 百度 此外,游艇上还有两间138平方米的豪华复式顶层套房。

YAML and Haml (indented syntax)

Less (SCSS)
Influenced
Less, Stylus, Tritium, Bootstrap (v4+)

Sass (short for syntactically awesome style sheets) is a preprocessor scripting language that is interpreted or compiled into Cascading Style Sheets (CSS). SassScript is the scripting language itself.

Sass consists of two syntaxes. The original syntax, called "the indented syntax," uses a syntax similar to Haml.[2][3] It uses indentation to separate code blocks and newline characters to separate rules. The newer syntax, SCSS (Sassy CSS), uses block formatting like that of CSS. It uses braces to denote code blocks and semicolons to separate rules within a block. The indented syntax and SCSS files are traditionally given the extensions .sass and .scss, respectively.[4]

CSS3 consists of a series of selectors and pseudo-selectors that group rules that apply to them. Sass (in the larger context of both syntaxes) extends CSS by providing several mechanisms available in more traditional programming languages, particularly object-oriented languages, but that are not available to CSS3 itself. When SassScript is interpreted, it creates blocks of CSS rules for various selectors as defined by the Sass file. The Sass interpreter translates SassScript into CSS. Alternatively, Sass can monitor the .sass or .scss file and translate it to an output .css file whenever the .sass or .scss file is saved.[5]

The indented syntax is a metalanguage. SCSS is a nested metalanguage and a superset of CSS, as valid CSS is valid SCSS with the same semantics.

SassScript provides the following mechanisms: variables, nesting, mixins,[3] and selector inheritance.[2]

History

[edit]

Sass was initially designed by Hampton Catlin and developed by Natalie Weizenbaum.[6][7]

Major implementations

[edit]

SassScript was implemented in multiple languages, the noteworthy implementations are:

  • The official open-source Dart implementation.[8]
  • The official "sass" node module on npm, which is Dart Sass compiled to pure JavaScript.[9]
  • The official "sass-embedded" node module which is a JavaScript wrapper around the native Dart executable.[10]
  • The original open-source Ruby implementation created in 2006,[8] since deprecated due to the lack of maintainers and reached End-of-Life in March 2019.[11][12]
  • libSass, the official open-source C++ implementation, deprecated in October 2020.[13]
  • The deprecated "node-sass" node module on npm, based on the deprecated libSass.[14]
  • JSass, an unofficial Java implementation,[15] based on the deprecated libSass.[16]
  • phamlp, an unofficial Sass/SCSS implementation in PHP.[8]
  • Vaadin has a Java implementation of Sass.[17]
  • Firebug, a Firefox XUL ("legacy") extension for web development.[18] It has been since deprecated in favor of developer tools integrated into Firefox itself. It stopped working since Firefox 57 dropped support for XUL extensions.

Features

[edit]

Variables

[edit]

Sass allows variables to be defined. Variables begin with a dollar sign ($). Variable assignment is done with a colon (:).[18]

SassScript supports four data types:[18]

  • Numbers (including units)
  • Strings (with quotes or without)
  • Colors (name, or names)
  • Booleans

Variables can be arguments to or results from one of several available functions.[19] During translation, the values of the variables are inserted into the output CSS document.[2]

SCSS Sass Compiled CSS
$primary-color: #3bbfce;
$margin: 16px;

.content-navigation {
  border-color: $primary-color;
  color: darken($primary-color, 10%);
}

.border {
  padding: $margin / 2;
  margin: $margin / 2;
  border-color: $primary-color;
}
$primary-color: #3bbfce
$margin: 16px

.content-navigation
  border-color: $primary-color
  color: darken($primary-color, 10%)

.border
  padding: $margin/2
  margin:  $margin/2
  border-color: $primary-color
:root{
    --primary-color:#3bbfce;
    --secondary-color:#2b9eab;
    --margin:8px;
}


.content-navigation {
  border-color: var(--secondary-color)
  color: var(--secondary-color);
}

.border {
  padding: 8px;
  margin: var(--margin);
  border-color: #3bbfce;
}

Nesting

[edit]

CSS does support logical nesting, but the code blocks themselves are not nested. Sass allows the nested code to be inserted within each other.[2]

SCSS Sass Compiled CSS
table.hl {
  margin: 2em 0;
  td.ln {
    text-align: right;
  }
}

li {
  font: {
    family: serif;
    weight: bold;
    size: 1.3em;
  }
}
table.hl 
  margin: 2em 0
  td.ln 
    text-align: right
  
li 
  font: 
    family: serif
    weight: bold
    size: 1.3em
table.hl {
  margin: 2em 0;
}
table.hl td.ln {
  text-align: right;
}

li {
  font-family: serif;
  font-weight: bold;
  font-size: 1.3em;
}

More complicated types of nesting including namespace nesting and parent references are discussed in the Sass documentation.[18]

SCSS Sass Compiled CSS
@mixin table-base {
  th {
    text-align: center;
    font-weight: bold;
  }
  td, th {
    padding: 2px;
  }
}

#data {
  @include table-base;
}
=table-base
  th
    text-align: center
    font-weight: bold
  td, th
    padding: 2px

#data
  +table-base
#data th {
  text-align: center;
  font-weight: bold;
}
#data td, #data th {
  padding: 2px;
}

Loops

[edit]

Sass allows for iterating over variables using @for, @each and @while, which can be used to apply different styles to elements with similar classes or ids.

Sass Compiled CSS
$squareCount: 4
@for $i from 1 to $squareCount 
  #square-#{$i} 
   background-color: red
   width: 50px * $i
   height: 120px / $i
#square-1 {
  background-color: red;
  width: 50px;
  height: 120px;
}

#square-2 {
  background-color: red;
  width: 100px;
  height: 60px;
}

#square-3 {
  background-color: red;
  width: 150px;
  height: 40px;
}

Arguments

[edit]

Mixins also support arguments.[2]

Sass Compiled CSS
=left($dist) 
  float: left
  margin-left: $dist

#data 
  +left(10px)
#data {
  float: left;
  margin-left: 10px;
}

In combination

[edit]
Sass Compiled CSS
=table-base
  th
    text-align: center
    font-weight: bold
  td, th 
    padding: 2px

=left($dist) 
  float: left
  margin-left: $dist

#data 
  +left(10px)
  +table-base
#data {
  float: left;
  margin-left: 10px;
}
#data th {
  text-align: center;
  font-weight: bold;
}
#data td, #data th {
  padding: 2px;
}

Selector inheritance

[edit]

While CSS3 supports the Document Object Model (DOM) hierarchy, it does not allow selector inheritance. In Sass, inheritance is achieved by inserting a line inside of a code block that uses the @extend keyword and references another selector. The extended selector's attributes are applied to the calling selector.[2]

Sass Compiled CSS
.error
  border: 1px #f00
  background: #fdd

.error.intrusion 
  font-size: 1.3em
  font-weight: bold

.badError 
  @extend .error
  border-width: 3px
.error, .badError {
  border: 1px #f00;
  background: #fdd;
}

.error.intrusion,
.badError.intrusion {
  font-size: 1.3em;
  font-weight: bold;
}

.badError {
  border-width: 3px;
}

Sass supports multiple inheritance.[18]

libSass

[edit]

At the 2012 HTML5 Developer Conference, Hampton Catlin, the creator of Sass, announced version 1.0 of libSass, an open source C++ implementation of Sass developed by Catlin, Aaron Leung, and the engineering team at Moovweb.[20][21]

According to Catlin, libSass can be "drop[ped] into anything and it will have Sass in it...You could drop it right into Firefox today and build Firefox and it will compile in there. We wrote our own parser from scratch to make sure that would be possible."[22]

The design goals of libSass are:

  • Performance – Developers have reported 10x speed up increases over the Ruby implementation of Sass.[23]
  • Easier integration – libSass makes it easier to integrate Sass into more software. Before libSass, tightly integrating Sass into a language or software product required bundling the entire Ruby interpreter. By contrast, libSass is a statically linkable library with zero external dependencies and C-like interface, making it easy to wrap Sass directly into other programming languages and tools. For example, open source libSass bindings now exist for Node, Go, and Ruby.[21]
  • Compatibility – libSass's goal is full compatibility with the official Ruby implementation of Sass. This goal has been achieved on libsass 3.3.[24]

IDE integration

[edit]
IDE integration of Sass
IDE Software
Adobe Dreamweaver CC 2017
Eclipse
Emacs sass-mode
JetBrains IntelliJ IDEA (Ultimate Edition)
JetBrains PhpStorm
JetBrains RubyMine
JetBrains WebStorm
Microsoft Visual Studio Mindscape
Microsoft Visual Studio SassyStudio
Microsoft WebMatrix
NetBeans
Vim haml.zip
Atom
Visual Studio Code
Sublime
Edit+

See also

[edit]

References

[edit]
  1. ^ a b "Dart Sass - latest release". github.com.
  2. ^ a b c d e f Media Mark (3.2.12). "Sass - Syntactically Awesome Stylesheets". Sass-lang.com. Retrieved 2025-08-06.{{cite web}}: CS1 maint: numeric names: authors list (link)
  3. ^ a b Firtman, Maximiliano (2025-08-06). Programming the Mobile Web. O'Reilly Media, Inc. ISBN 978-1-4493-3497-0.
  4. ^ Libby, Alex (2019). Introducing Dart Sass: A Practical Introduction to the Replacement for Sass, Built on Dart. Berkeley, CA: Apress. doi:10.1007/978-1-4842-4372-5. ISBN 978-1-4842-4371-8.
  5. ^ Sass - Syntactically Awesome Stylesheets Archived 2025-08-06 at the Wayback Machine Tutorial
  6. ^ "Sass: Syntactically Awesome Style Sheets". sass-lang.com. Archived from the original on 2025-08-06.
  7. ^ "Natalie Weizenbaum's blog". Archived from the original on 2025-08-06.
  8. ^ a b c "Sass / Scss". Drupal.org. 2025-08-06. Archived from the original on 2025-08-06. Retrieved 2025-08-06.
  9. ^ "sass". www.npmjs.com.
  10. ^ "sass-embedded". www.npmjs.com.
  11. ^ Weizenbaum, Natalie. "Ruby Sass Has Reached End-Of-Life ? Sass Blog". sass.logdown.com. Retrieved 2025-08-06.
  12. ^ "Sass: Ruby Sass". sass-lang.com. Retrieved 2025-08-06.
  13. ^ "LibSass is Deprecated". sass-lang.com. 26 October 2020.
  14. ^ "node-sass". www.npmjs.com.
  15. ^ "jsass - A Java implementation of the Sass compiler (and some other goodies). - Google Project Hosting". Retrieved 2025-08-06.
  16. ^ "JSass documentation". jsass.readthedocs.io.
  17. ^ "SassCompiler (Vaadin 7.0.7 API)". Vaadin.com. 2025-08-06. Archived from the original on 2025-08-06. Retrieved 2025-08-06.
  18. ^ a b c d e Sass (Syntactically Awesome StyleSheets) SASS_REFERENCE
  19. ^ Module: Sass::Script::Functions Sass Functions
  20. ^ H. Catlin (2025-08-06). "Hampton's 6 Rules of Mobile Design". HTML5 Developer Conference. Archived from the original on 2025-08-06. Retrieved 2025-08-06.
  21. ^ a b M. Catlin (2025-08-06). "libsass". Moovweb Blog. Archived from the original on 2025-08-06. Retrieved 2025-08-06.
  22. ^ A. Stacoviak & A. Thorp (2025-08-06). "Sass, libsass, Haml and more with Hampton Catlin". Archived from the original on 2025-08-06. Retrieved 2025-08-06.
  23. ^ D. Le Nouaille (2025-08-06). "Sassc and Bourbon". Retrieved 2025-08-06.
  24. ^ "Sass Compatibility". sass-compatibility.github.io. Archived from the original on 2025-08-06. Retrieved 2025-08-06.

Further reading

[edit]
[edit]
脊柱侧弯有什么危害 女人打掉孩子说明什么 st是什么意思 鸡属于什么类动物 尿频尿急尿不尽吃什么药最快见效
笔画最多的字是什么 什么可以吃 神隐是什么意思 减肥去医院挂什么科 宝宝什么时候添加辅食最好
990是什么意思 开光的手串有什么禁忌 为什么头发总是很油 身体缺钾是什么原因造成的 中秋节送礼送什么
磷高有什么症状和危害 窦性心律过缓吃什么药 支原体培养阳性是什么意思 龙什么鱼 九月3日是什么日子
痔疮很痒是什么原因hcv8jop4ns9r.cn 中性粒细胞绝对值偏高是什么原因hcv8jop4ns6r.cn 翻糖蛋糕是什么意思hcv8jop7ns5r.cn 手指甲看什么科室hcv9jop7ns3r.cn 中伤是什么意思hcv9jop6ns0r.cn
背上有痣代表什么hcv7jop7ns1r.cn bye什么意思hcv9jop6ns2r.cn 可谓是什么意思520myf.com 吃软饭是什么意思hcv8jop8ns4r.cn only是什么牌子creativexi.com
四物汤什么时候喝最好hcv8jop1ns6r.cn charcoal是什么颜色hcv8jop6ns0r.cn 五月出生是什么星座hcv8jop2ns9r.cn 烤冷面是什么做的hcv8jop1ns9r.cn 百合有什么作用hcv7jop6ns6r.cn
耵聍栓塞是什么意思hcv8jop9ns6r.cn 为什么吃辣的就拉肚子hcv8jop8ns1r.cn 小学生什么时候放假hcv8jop0ns6r.cn 饿是什么感觉xjhesheng.com 为什么大姨妈迟迟不来hcv9jop4ns3r.cn
百度