what is sass css code example
Example 1: sass vs scss
/* Answer to: "sass vs scss" */
/*
The basic difference is the syntax. While SASS has a loose syntax
with white space and no semicolons, the SCSS resembles more to CSS.
SASS stands for Syntactically Awesome StyleSheets. It is an
extension of CSS that adds power and elegance to the basic
language.
There's more differences but too much for me! Fortunately, someone
else asked the same question over in StackOverflow! Here's a link
to their answer:
https://stackoverflow.com/questions/5654447/whats-the-difference-between-scss-and-sass
*/
Example 2: what is scss
SCSS is a preprocessor which lets you use features that aren’t a part of the wider CSS standard yet, and provides better workflows for maintaining your stylesheets.
With SCSS preprocessor, you can reduce the amount of times you repeat yourself and ensure you’re writing clean, maintainable code for the future.
Scss can take css code and work.
SCSS is fully compatible with the syntax of CSS, while still supporting the full power of Sass.
Scss is an extension of the syntax of CSS. This means that every valid CSS stylesheet is a valid SCSS file with the same meaning. In addition, SCSS understands most CSS hacks and vendor-specific syntax, such as IE's old filtersyntax. This syntax is enhanced with the Sass features described below. Files using this syntax have the .scss extension.
Dry (dont repeat yourself) code is much better then wet code (write every time).
Example 3: css sass scss
/*SMART DIFFERENCE*/
/*CSS*/
body {
font: 100% Helvetica, sans-serif;
color:
}
/*SCSS*/
$font-stack: Helvetica, sans-serif;
$primary-color:
body {
font: 100% $font-stack;
color: $primary-color;
}
/*SASS*/
$font-stack: Helvetica, sans-serif
$primary-color:
body
font: 100% $font-stack
color: $primary-color
Example 4: sass
npm install -g sass
Example 5: sass
npm uninstall node-sass
npm install [email protected]
Example 6: scss
sass --watch input.scss output.css