@mixin triangle($size, $color, $direction) {
height: 0;
width: 0;
border-color: transparent;
border-style: solid;
border-width: $size / 2;
@if $direction == up {
border-bottom-color: $color;
} @else if $direction == right {
border-left-color: $color;
} @else if $direction == down {
border-top-color: $color;
} @else if $direction == left {
border-right-color: $color;
} @else {
@error "Unknown direction #{$direction}.";
}
}
.next {
@include triangle(5px, black, right);
}
sass --watch example.scss output.css
SASS will watch example.scss file changes and will compile it immediately after every changeExtensions (left navigation)
-> search & install
-> Manage (left bottom)
-> Settings
-> search (live sass...)
-> Edit in settings.json
Possible values for format
part of settings: expanded / compressed
Default location is null
(root) but we can put "css/"
When format is compressed
we can put .min.css
as extensionName
$primary-color: blue;
$secondary-color: lightblue;
And then we can import the partial into style.scss:@import 'config';
@function set-text-color($color) {
@if (lightness($color) > 70) {
@return #333;
} @else {
@return #fff;
}
}
Calling the function - "set-text-color":h1 {
background-color: $primary-color;
color: set-text-color($primary-color);
}
// set text color based on bg
@function set-text-color($color) {
@if (lightness($color) > 70) {
@return #333;
} @else {
@return #fff;
}
}
// set bg color & text color
@mixin set-background($color) {
background-color: $color;
color: set-text-color($color);
}
Use the mixin - "set-background"h1 {
@include set-background($primary-color);
}
Changing bg-color effect on text-color: https://youtu.be/nu5mdN2JIwM?t=2333Project = Repository
(Woring directory)
Staging = Control what gets committed
Commit = Git's way of save