SlideShare ist ein Scribd-Unternehmen logo
1 von 22
www.tothenew.com
The SASS way
Yatendra
Bhardwaj
www.tothenew.com
Agenda
● SASS installation
● What is Sass?
● Why Would we use Sass?
● Difference b/w Sass and Scss
● Variables In Sass
● Math in Sass
● Functions
● Nesting
● Imports
● Partials
● Extends & placeholders
● Mixins
● Function
● Difference between Functions & Mixins
www.tothenew.com
Installation
For Practice we will use:- Sassmeister
1. Download the Ruby installer: http://rubyinstaller.org/downloads/
1. In cmd run command :
gem install sass
1. Go to folder in which your scss folder exists and open cmd run command:
sass --watch scss:css
www.tothenew.com
What is SASS
Sass (Syntactically Awesome Style Sheets)
SASS is a CSS Preprocessor.
Sass adds a feature set to your stylesheet markup that makes writing styles fun again.
CSS stylesheets are getting larger, more complex, and harder to maintain.
This is where a preprocessor can help.
Sass lets you use features that don't exist in CSS yet, like
1. Variables
2. Nesting
3. Mixins
4. Function
www.tothenew.com
Why would we use Sass?
● Easily Maintainable
● More Done in Less Code
● More Readable in Less Time
● More Features like :-
1. Variables
2. Math
3. Functions
4. Nesting
5. Imports
6. Extends & Placeholders
7. Mixins
8. Function
www.tothenew.com
Difference b/w Sass and Scss
SASS vs SCSS
SASS : When Sass first came out, the main syntax was noticeably different from CSS. It used
indentation instead of braces, didn't require semicolons and had shorthand operators.
SCSS : In version 3 Sass changed it's main syntax to .scss.
SCSS is a superset of CSS, and is basically written the exact same, but with all the fun new Sass
features.
www.tothenew.com
SASS vs SCSS
www.tothenew.com
Variables in SASS
Variables allow you to assign a value to an easy-to-remember placeholder name.
Works with hex values, strings of text, colors, numbers, boolean values, or even value lists
In Short--
No more memorizing hex values :)
Example :--
https://www.sassmeister.com/gist/646f359c2e503ec5020f61ef562acfb2
www.tothenew.com
Math in SASS
Unlike CSS, Sass allows us to use mathematical
expressions! This is super helpful within mixins,
and allows us to do some really cool things with
our markup.
www.tothenew.com
Examples of Math in Sass
www.tothenew.com
Nesting
Basic nesting refers to the ability to have a declaration inside of a declaration. In normal CSS we might
write:
CssSASS
www.tothenew.com
Nesting
when u have something like :- a:hover, a:active or two classes on same div eg .box.square or .col-
span-1
www.tothenew.com
Imports
Imports allow you to break your styles into separate files and import them into one another.
In fact, we don't even really need the extension:
www.tothenew.com
Partials
If you prefix a .sass or .scss file with an underscore, it will not get compiled to
CSS. This is helpful if your file only exists to get imported into a master
style.scss and not explicitly compiled.
_partial.scss.
@import _partial.scss.
www.tothenew.com
Extend
In Sass, the @extend directive is an outstanding way to inherit already existing styles.
www.tothenew.com
Placeholders
But what about if we want to extend a declaration with a set of styles that doesn't already
exist? Meet the placeholder selector.
www.tothenew.com
Mixins
It allows you to include styles the same way @extend would, but with the ability to supply and
interpret arguments.
SASS
CSS
www.tothenew.com
Function
A function looks a lot like a mixin, and they both accept the same types of arguments. Although they
look similar,a Sass function behaves differently. While a mixin makes our life easier by lessening
typing repetitive code, a function allows you to strip repeatable logic from your code.
www.tothenew.com
Difference between functions and mixins
function
Mixin
www.tothenew.com
Adding fonts in SASS
Adding fonts from from local:
@font-face {
font-family: 'Calibri';
src: url('../fonts/Calibri.eot');
src: url('../fonts/Calibri.eot?#iefix') format('embedded-opentype'),
url('../fonts/Calibri.woff') format('woff'),
url('../fonts/Calibri.ttf') format('truetype');
font-weight: normal;
font-style: normal;
}
Adding Google Fonts:-
Just add link of your google fonts in top of your scss file.
www.tothenew.com
Exercise
https://www.sassmeister.com/gist/4821a904cf70799d99d9724a6935d276
Use Roboto font from google font in exercise
www.tothenew.com
Thank You

Weitere ähnliche Inhalte

Ähnlich wie The sass way - Yatendra Bhardwaj

Ähnlich wie The sass way - Yatendra Bhardwaj (20)

Sass that CSS
Sass that CSSSass that CSS
Sass that CSS
 
Syntactically Awesome Stylesheet - A workshop by Citytech Software
Syntactically Awesome Stylesheet - A workshop by Citytech SoftwareSyntactically Awesome Stylesheet - A workshop by Citytech Software
Syntactically Awesome Stylesheet - A workshop by Citytech Software
 
Intro to Sass for WordPress Developers
Intro to Sass for WordPress DevelopersIntro to Sass for WordPress Developers
Intro to Sass for WordPress Developers
 
Sass_Cubet seminar
Sass_Cubet seminarSass_Cubet seminar
Sass_Cubet seminar
 
Getting Sassy with CSS
Getting Sassy with CSSGetting Sassy with CSS
Getting Sassy with CSS
 
Styling your projects! leveraging css and r sass in r projects
Styling your projects! leveraging css and r sass in r projectsStyling your projects! leveraging css and r sass in r projects
Styling your projects! leveraging css and r sass in r projects
 
SASS - Syntactically Awesome Stylesheet
SASS - Syntactically Awesome StylesheetSASS - Syntactically Awesome Stylesheet
SASS - Syntactically Awesome Stylesheet
 
An Introduction to CSS Preprocessors (SASS & LESS)
An Introduction to CSS Preprocessors (SASS & LESS)An Introduction to CSS Preprocessors (SASS & LESS)
An Introduction to CSS Preprocessors (SASS & LESS)
 
Sass
SassSass
Sass
 
Authoring Stylesheets with Compass & Sass
Authoring Stylesheets with Compass & SassAuthoring Stylesheets with Compass & Sass
Authoring Stylesheets with Compass & Sass
 
Less vs sass
Less vs sassLess vs sass
Less vs sass
 
Make your CSS beautiful again
Make your CSS beautiful againMake your CSS beautiful again
Make your CSS beautiful again
 
The World of Stylesheet Languages
The World of Stylesheet LanguagesThe World of Stylesheet Languages
The World of Stylesheet Languages
 
Sass - basic to advance
Sass  - basic to advanceSass  - basic to advance
Sass - basic to advance
 
Sass presentation
Sass presentationSass presentation
Sass presentation
 
The CSS Handbook
The CSS HandbookThe CSS Handbook
The CSS Handbook
 
European SharePoint Webinar - Make SharePoint Sassy
European SharePoint Webinar - Make SharePoint SassyEuropean SharePoint Webinar - Make SharePoint Sassy
European SharePoint Webinar - Make SharePoint Sassy
 
Preprocessor CSS: SASS
Preprocessor CSS: SASSPreprocessor CSS: SASS
Preprocessor CSS: SASS
 
Stop your share point css become a di-sass-ter today - SPS Munich
Stop your share point css become a di-sass-ter today - SPS MunichStop your share point css become a di-sass-ter today - SPS Munich
Stop your share point css become a di-sass-ter today - SPS Munich
 
Less
LessLess
Less
 

Kürzlich hochgeladen

EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
Earley Information Science
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
vu2urc
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
Joaquim Jorge
 

Kürzlich hochgeladen (20)

GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptx
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path Mount
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slides
 

The sass way - Yatendra Bhardwaj