Patricio Vargas
Software Engineer
{ Syntactically Awesome Stylesheets}
{Don't repeat your self}
.SCSS AND .SASS
.content-navigation
border-color: $blue
color: darken($blue, 9%)
.content-navigation {
border-color: $blue;
color: darken($blue, 9%);
}
npm install -g sass
sass your-scss-file-path your-css-file-path
sass sass/styles.scss css/styles.css
$font: Helvetica, sans-serif;
$primary-color: #222;
body {
font: 100% $font;
color: $primary-color;
}
$font: Helvetica, sans-serif;
$primary-color: #222;
body {
font: 100% $font;
color: $primary-color;
}
body {
font: 100% Helvetica, sans-serif;
color: #222;
}
.scss
.css
div {
height: 100vh;
a {
color: $primary-color;
}
}
div {
height: 100vh;
}
div a {
color: #222;
}
div {
height: 100vh;
a {
color: $primary-color
}
}
.scss
.css
@mixin transform($property) {
-webkit-transform: $property;
-ms-transform: $property;
transform: $property;
}
.card-box {
@include transform(rotate(30deg));
}
@mixin transform($property) {
-webkit-transform: $property;
-ms-transform: $property;
transform: $property;
}
.card-box {
@include transform(rotate(30deg));
color: #000;
}
.card-box {
-webkit-transform: rotate(30deg);
-ms-transform: rotate(30deg);
transform: rotate(30deg);
color: #000;
}
.scss
.css
@function my-calc($x, $y){
@return $x + $y
}
@function my-calc($x, $y){
@return $x + $y
}
.my-module {
padding: my-calc(10px, 5px);
}
.scss
.css
2px+2px
2px + 2px
.btn {
border-radius: 3px;
border: 1px solid red;
}
You might name it something like _buttons.scss
/*ABSTRACT*/
@import "abstracts/functions";
@import "abstracts/mixins";
@import "abstracts/variables";
/*BASE*/
@import "base/base";
@import "base/animations";
@import "base/typography";
@import "base/utilities";
/*LAYOUT*/
@import "layout/header";
@import "layout/grid";
@import "layout/footer";
@import "layout/navigation";
/*COMPONENTS*/
@import "components/button";
@import "components/composition";
@import "components/feature-box";
@import "components/cards";
@import "components/story";
@import "components/bg-video";
@import "components/form";
@import "components/popup";
/*PAGES*/
@import "pages/home";
/*MEDIA QUERIES*/
@import "mediaQueries/queries";
@mixin response($breakpoint) {
@if $breakpoint == big-desktop {
//1800px
@media (min-width: 112.5em) {
@content;
}
} @else if $breakpoint == tab-land {
//<1200px
@media (max-width: 75em) {
@content;
}
} @else if $breakpoint == tab-port {
//<900px
@media (max-width: 56.25em) {
@content;
}
} @else {
//<600px
@media (max-width: 37.5em) {
@content;
}
}
}
@include response(big-desktop) {
-webkit-clip-path:
polygon(0 0, 100% 0, 100% 85vh, 0 100%);
clip-path:
polygon(0 0, 100% 0, 100% 85vh, 0 100%);
}
By Patricio Vargas
Presentation on how to get started with SASS