Supercharge your development with unmatched features:
Access a full terminal environment, run Linux commands, and manage your project’s dependencies directly within the IDE.
Browse and interact with websites directly within the IDE. Supports real-time interaction with web content without leaving the workspace.
Manage your project files and directories effortlessly within the IDE. Create, edit, rename, move, and delete files—all in one place.
Experience seamless code editing with real-time syntax highlighting, tab support, and intelligent code suggestions for a smoother development workflow.
SASS (Syntactically Awesome Stylesheets) is a preprocessor scripting language that is interpreted or compiled into CSS. It extends CSS with features like variables, nested rules, and functions to make stylesheets more maintainable and easier to write.
To use SASS, you'll first need to install it. If you have Node.js installed, you can install SASS using npm:
npm install -g sass
After installation, you can compile your SASS files into CSS by running:
sass input.scss output.css
SASS comes in two syntaxes: indented and CSS-style. The indented syntax uses indentation instead of curly braces and semicolons, while the CSS-style syntax uses curly braces and semicolons.
Indented Syntax:
$primary-color: #333
nav
background-color: $primary-color
color: white
CSS-style Syntax:
$primary-color: #333;
nav {
background-color: $primary-color;
color: white;
}
Variables in SASS allow you to store values (such as colors, fonts, or any CSS property) that can be reused throughout the stylesheet. Example:
$font-stack: Helvetica, sans-serif;
$primary-color: #333;
body {
font: 100% $font-stack;
color: $primary-color;
}
In SASS, you can nest your CSS selectors in a way that mirrors the HTML structure. This makes the code more readable and hierarchical. Example:
nav {
background-color: #333;
ul {
list-style-type: none;
}
li {
display: inline-block;
}
a {
color: white;
text-decoration: none;
}
}
Partials in SASS allow you to break up your stylesheets into smaller, reusable pieces. These partials can then be imported into a main stylesheet using the @import
directive.
Example of a partial file (_header.scss):
$header-color: #ffcc00;
header {
background-color: $header-color;
}
Then import it into your main stylesheet:
@import 'header';
Mixins allow you to reuse a set of properties with different values. You can pass arguments to mixins, making them flexible. Example:
Extend allows one selector to inherit the styles of another without duplicating the code. Example:
.btn {
padding: 10px;
background-color: blue;
}
.primary-btn {
@extend .btn;
color: white;
}
SASS supports arithmetic operations like addition, subtraction, multiplication, and division. Example:
$width: 10px + 5px;
$height: $width * 2;
.box {
width: $width;
height: $height;
}
Once you've written your SASS code, you need to compile it into regular CSS. You can do this using the SASS command in your terminal:
sass input.scss output.css
For continuous compilation, use the watch mode:
sass --watch input.scss:output.css