[{"@context":"http:\/\/schema.org\/","@type":"BlogPosting","@id":"https:\/\/wiki.edu.vn\/en\/wiki24\/sass-style-sheet-language-wikipedia\/#BlogPosting","mainEntityOfPage":"https:\/\/wiki.edu.vn\/en\/wiki24\/sass-style-sheet-language-wikipedia\/","headline":"Sass (style sheet language) – Wikipedia","name":"Sass (style sheet language) – Wikipedia","description":"From Wikipedia, the free encyclopedia Stylesheet language Sass (short for syntactically awesome style sheets) is a preprocessor scripting language that","datePublished":"2019-03-19","dateModified":"2019-03-19","author":{"@type":"Person","@id":"https:\/\/wiki.edu.vn\/en\/wiki24\/author\/lordneo\/#Person","name":"lordneo","url":"https:\/\/wiki.edu.vn\/en\/wiki24\/author\/lordneo\/","image":{"@type":"ImageObject","@id":"https:\/\/secure.gravatar.com\/avatar\/c9645c498c9701c88b89b8537773dd7c?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/c9645c498c9701c88b89b8537773dd7c?s=96&d=mm&r=g","height":96,"width":96}},"publisher":{"@type":"Organization","name":"Enzyklop\u00e4die","logo":{"@type":"ImageObject","@id":"https:\/\/wiki.edu.vn\/wiki4\/wp-content\/uploads\/2023\/08\/download.jpg","url":"https:\/\/wiki.edu.vn\/wiki4\/wp-content\/uploads\/2023\/08\/download.jpg","width":600,"height":60}},"image":{"@type":"ImageObject","@id":"https:\/\/en.wikipedia.org\/wiki\/Special:CentralAutoLogin\/start?type=1x1","url":"https:\/\/en.wikipedia.org\/wiki\/Special:CentralAutoLogin\/start?type=1x1","height":"1","width":"1"},"url":"https:\/\/wiki.edu.vn\/en\/wiki24\/sass-style-sheet-language-wikipedia\/","wordCount":5990,"articleBody":"From Wikipedia, the free encyclopediaStylesheet languageSass (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] 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.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.[3]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, and selector inheritance.[2]Table of ContentsHistory[edit]Major implementations[edit]Features[edit]Variables[edit]Nesting[edit]Loops[edit]Arguments[edit]In combination[edit]Selector inheritance[edit]libSass[edit]IDE integration[edit]See also[edit]References[edit]External links[edit]History[edit]Sass was initially designed by Hampton Catlin and developed by Natalie Weizenbaum.[4][5] After its initial versions, Weizenbaum and Chris Eppstein have continued to extend Sass with SassScript, a scripting language used in Sass files.Major implementations[edit]SassScript was implemented in multiple languages, the noteworthy implementations are:The official open-source Dart implementation.[6]The official “sass” node module on npm, which is Dart Sass compiled to pure JavaScript.[7]The official “sass-embedded” node module which is a JavaScript wrapper around the native Dart executable.[8]The original open-source Ruby implementation created in 2006,[6] since deprecated due to the lack of maintainers and reached End-of-Life in March 2019.[9][10]libSass, the official open-source C++ implementation, deprecated in October 2020.[11]The deprecated “node-sass” node module on npm, based on the deprecated libSass.[12]JSass, an unofficial Java implementation,[13] based on the deprecated libSass.[14]phamlp, an unofficial Sass\/SCSS implementation in PHP.[6]Vaadin has a Java implementation of Sass.[15]Firebug, a Firefox XUL (“legacy”) extension for web development.[16] 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 (:).[16]SassScript supports four data types:[16]Numbers (including units)Strings (with quotes or without)Colors (name, or names)BooleansVariables can be arguments to or results from one of several available functions.[17] During translation, the values of the variables are inserted into the output CSS document.[2]SCSSSassCompiled 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.content-navigation { border-color: #3bbfce; color: #2b9eab;}.border { padding: 8px; margin: 8px; 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]SCSSSassCompiled CSStable.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.3emtable.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.[16]SCSSSassCompiled 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.SassCompiled CSS$squareCount: 4@for $i from 1 through $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]SassCompiled CSS=left($dist) float: left margin-left: $dist#data +left(10px)#data { float: left; margin-left: 10px;}In combination[edit]SassCompiled 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]SassCompiled 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.[16]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.[18][19] Current Sass maintainer, Chris Eppstein, has expressed intent to contribute as well.[20]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.”[21]The design goals of libSass are:Performance\u00a0\u2013 Developers have reported 10x speed up increases over the Ruby implementation of Sass.[22]Easier integration\u00a0\u2013 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.[19]Compatibility\u00a0\u2013 libSass’s goal is full compatibility with the official Ruby implementation of Sass. This goal has been achieved on libsass 3.3.[23]IDE integration[edit]See also[edit]References[edit]External links[edit] "},{"@context":"http:\/\/schema.org\/","@type":"BreadcrumbList","itemListElement":[{"@type":"ListItem","position":1,"item":{"@id":"https:\/\/wiki.edu.vn\/en\/wiki24\/#breadcrumbitem","name":"Enzyklop\u00e4die"}},{"@type":"ListItem","position":2,"item":{"@id":"https:\/\/wiki.edu.vn\/en\/wiki24\/sass-style-sheet-language-wikipedia\/#breadcrumbitem","name":"Sass (style sheet language) – Wikipedia"}}]}]