A CSS Preprocessor is a tool used to extend the basic functionality of default vanilla CSS through its own scripting language. It helps us to use complex logical syntax like – variables, functions, mixins, code nesting, and inheritance to name a few, supercharging your vanilla CSS.
Sass is the acronym for “Syntactically Awesome Style Sheets”. SASS can be written in two different syntaxes using SASS or SCSS
$font-color: #fff $bg-color: #00f #box color: $font-color background: $bg-color
$font-color: #fff; $bg-color: #00f; #box{ color: $font-color; background: $bg-color; }
LESS is an acronym for “Leaner Stylesheets”. LESS is easy to add to any javascript project by using NPM or less.js file. It uses the extension .less.
LESS syntax is the same as the SCSS with some exceptions. LESS uses @ to define the variables.
@font-color: #fff; @bg-color: #00f #box{ color: @font-color; background: @bg-color; }
Stylus offers a great deal of flexibility in writing syntax, supports native CSS as well as allows the omission of brackets, colons, and semicolons. It doesn’t use @ or $ for defining variables.
/* STYLUS SYNTAX WRITTEN LIKE NATIVE CSS */ font-color= #fff; bg-color = #00f; #box { color: font-color; background: bg-color; } /* OR */ /* STYLUS SYNTAX WITHOUT CURLY BRACES */ font-color= #fff; bg-color = #00f; #box color: font-color; background: bg-color;
Article ID: 1060
Created: Fri, Jun 3, 2022
Last Updated: Fri, Jun 3, 2022
Author: Administrator
Online URL: https://www.articlediary.com/article/what-is-a-css-preprocessor-what-are-sass-less-and-stylus-1060.html