SlideShare ist ein Scribd-Unternehmen logo
1 von 20
Why use SASS?
Time for a CSS compiler has come!

1
Table of contents
•
•
•
•
•
•

CSS cons and pros
SASS brings the powers to CSS
Demos
FAQs
References
Q/A

2
CSS cons and pros
• The advantages of using CSS include:
1.
2.
3.
4.

More precise formatting
Separation of HTML content from appearance
Saves time, easier site maintenance
Web accessibility

• Some disadvantages to using CSS:
1.
2.
3.
4.

Inconsistent browser support
Not for long term use
Hard expandability
Making changes is not easy

3
THE DRY PRINCIPLE
Every piece of knowledge must have a single, unambiguous, authoritative
representation within a system.

Repeat code is everywhere(color, font family, padding…)

What happen if client
want to change to a new
font family or a new
color?

4
Powers of SASS
CSS on its own can be fun, but 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
variables, nesting, mixins, inheritance and other nifty goodies that make
writing CSS fun again.

Variables

Mixins

Inheritance

Nesting

Partials/Import

Operators

Functions

Controls
5
Variables
Think of variables as a way to store information that you want to
reuse throughout your stylesheet

Client wants to change
font across the site

Change the value only in one
place and the other updates
accordingly
6
Nesting
Sass will let you nest your CSS selectors in a way that follows the same visual
hierarchy of your HTML
HTML

SCSS

CSS

You don’t need to repeat the parent element each time you code style for a child
element. Nesting brings to you a visual view of your stylesheet, it means more
control…

7
Partials/Import
Partial Sass file(file named with a leading underscore) that contain little
snippets of CSS modularize your CSS and help keep things easier to maintain.
Sass partials are used with the @import directive

_variables.scss

_mixin.scss
main.scss

8
Mixins
A mixin lets you make groups of CSS declarations that you want to reuse
throughout your site. You can even pass in values to make your mixin more
flexible.
Mixin

Call mixin with a varibale

CSS output
They do look a lot like functions
of course. But since Sass actually
has real functions in the
language it’s probably best to
dispel this notion.
9
Extend/Inheritance
Using @extend lets you share a set of CSS properties from one selector to
another. It helps keep your Sass very DRY.

.btn works as core button

.btn—blue and .btn-shadow
inherits from .btn and adds its
own properties

10
Operators
SassScript supports the standard arithmetic operations on numbers
(addition +, subtraction -, multiplication *, division /, and modulo %), and will
automatically convert between units if it can
Numeric operations

compile to

11
Operators(cont)
All arithmetic operations are supported for color values, where they work
piecewise
Color operations

12
Operators(cont)
The + operation can be used to concatenate strings
String operations

use with variable

13
Controls
SassScript supports basic control directives for including styles only under some
conditions or including the same style several times with variations

@if ,@else if and @else

@while

@for

@each

Demo

14
Function
A function is very similar to a mixin, however function always return a value
Mixin

Function

Functions help you write more readable and DRY Sass by letting you
move your reusable logic out of specific declarations and even out of your
mixins
15
Compass
As if SASS isn't awesome enough on it's own, Compass comes with an
extra set of awesomeness.

16
FAQs
? Do I need to know Ruby or advanced commandline?
? Will I need to completely change the way I’ve been
writing stylesheets?
? Will the CSS it outputs be bloated and unreadable?

The answer is nope

17
Demos

18
References
• Articles:
o
o
o
o
o
o

Why Sass?
Using pure Sass functions to make reusable logic more useful
Using SASS or SCSS?
Mistakes when using SASS
Perspective of a Preprocessor
Why SASS and Compass should be in your workflow?

• Web documents:
o Sass Basics
o Sass Documentation

• Web archives:
o CSS Weekly

19
Thank you for your
attention!

20

Weitere ähnliche Inhalte

Kürzlich hochgeladen

IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
Enterprise Knowledge
 

Kürzlich hochgeladen (20)

🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
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)
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.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
[2024]Digital Global Overview Report 2024 Meltwater.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
 
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
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
 
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
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 

Empfohlen

How Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthHow Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental Health
ThinkNow
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie Insights
Kurio // The Social Media Age(ncy)
 

Empfohlen (20)

2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by Hubspot2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by Hubspot
 
Everything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPTEverything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPT
 
Product Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage EngineeringsProduct Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage Engineerings
 
How Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthHow Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental Health
 
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfAI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
 
Skeleton Culture Code
Skeleton Culture CodeSkeleton Culture Code
Skeleton Culture Code
 
PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024
 
Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)
 
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie Insights
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search Intent
 
How to have difficult conversations
How to have difficult conversations How to have difficult conversations
How to have difficult conversations
 
Introduction to Data Science
Introduction to Data ScienceIntroduction to Data Science
Introduction to Data Science
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best Practices
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project management
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
 

Why should you use SASS in your project?

  • 1. Why use SASS? Time for a CSS compiler has come! 1
  • 2. Table of contents • • • • • • CSS cons and pros SASS brings the powers to CSS Demos FAQs References Q/A 2
  • 3. CSS cons and pros • The advantages of using CSS include: 1. 2. 3. 4. More precise formatting Separation of HTML content from appearance Saves time, easier site maintenance Web accessibility • Some disadvantages to using CSS: 1. 2. 3. 4. Inconsistent browser support Not for long term use Hard expandability Making changes is not easy 3
  • 4. THE DRY PRINCIPLE Every piece of knowledge must have a single, unambiguous, authoritative representation within a system. Repeat code is everywhere(color, font family, padding…) What happen if client want to change to a new font family or a new color? 4
  • 5. Powers of SASS CSS on its own can be fun, but 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 variables, nesting, mixins, inheritance and other nifty goodies that make writing CSS fun again. Variables Mixins Inheritance Nesting Partials/Import Operators Functions Controls 5
  • 6. Variables Think of variables as a way to store information that you want to reuse throughout your stylesheet Client wants to change font across the site Change the value only in one place and the other updates accordingly 6
  • 7. Nesting Sass will let you nest your CSS selectors in a way that follows the same visual hierarchy of your HTML HTML SCSS CSS You don’t need to repeat the parent element each time you code style for a child element. Nesting brings to you a visual view of your stylesheet, it means more control… 7
  • 8. Partials/Import Partial Sass file(file named with a leading underscore) that contain little snippets of CSS modularize your CSS and help keep things easier to maintain. Sass partials are used with the @import directive _variables.scss _mixin.scss main.scss 8
  • 9. Mixins A mixin lets you make groups of CSS declarations that you want to reuse throughout your site. You can even pass in values to make your mixin more flexible. Mixin Call mixin with a varibale CSS output They do look a lot like functions of course. But since Sass actually has real functions in the language it’s probably best to dispel this notion. 9
  • 10. Extend/Inheritance Using @extend lets you share a set of CSS properties from one selector to another. It helps keep your Sass very DRY. .btn works as core button .btn—blue and .btn-shadow inherits from .btn and adds its own properties 10
  • 11. Operators SassScript supports the standard arithmetic operations on numbers (addition +, subtraction -, multiplication *, division /, and modulo %), and will automatically convert between units if it can Numeric operations compile to 11
  • 12. Operators(cont) All arithmetic operations are supported for color values, where they work piecewise Color operations 12
  • 13. Operators(cont) The + operation can be used to concatenate strings String operations use with variable 13
  • 14. Controls SassScript supports basic control directives for including styles only under some conditions or including the same style several times with variations @if ,@else if and @else @while @for @each Demo 14
  • 15. Function A function is very similar to a mixin, however function always return a value Mixin Function Functions help you write more readable and DRY Sass by letting you move your reusable logic out of specific declarations and even out of your mixins 15
  • 16. Compass As if SASS isn't awesome enough on it's own, Compass comes with an extra set of awesomeness. 16
  • 17. FAQs ? Do I need to know Ruby or advanced commandline? ? Will I need to completely change the way I’ve been writing stylesheets? ? Will the CSS it outputs be bloated and unreadable? The answer is nope 17
  • 19. References • Articles: o o o o o o Why Sass? Using pure Sass functions to make reusable logic more useful Using SASS or SCSS? Mistakes when using SASS Perspective of a Preprocessor Why SASS and Compass should be in your workflow? • Web documents: o Sass Basics o Sass Documentation • Web archives: o CSS Weekly 19
  • 20. Thank you for your attention! 20