SlideShare a Scribd company logo
SASS
BY - Neha Sharma (nehha255@gmail.com)
Syntactically Awesome Style Sheets
AGENDA
Part One – Introduction
• What is SASS
• Why we need SASS
• SASS vs SCSS
• Let’s meet the SASS
Part Two – Syntax
• Nesting
• Variables and Scope
• !default
• !global
• Data Types
• @extend and @extend only
• Mixins
• &
• Interpolation #{}
• @at-root
We love CSS
It’s a question not a statement.
CSS and Issues
• Lot of CSS3 Vendor Prefixes
• Repeated code
• Changing value in single file is nightmare
• Big team working on same and big css file is issue
• No logic base styling
What you want to change?
Cleaner code, Logical Code, non-repeated code, less pain to write
and maintain and much more…
Why SASS?
What is SASS?
• Scripting language
• Syntactically Awesome stylesheet
• CSS Pre- Processor – Compile the SASS/SCSS files to CSS
• Developed in 2007
• Full css3 compatible
• Helps in writing clean, DRY-approach CSS
Advantages of SASS
• DRY – Don’t Repeat Yourself
• Modules
• Lots of features
• Mathematical calculations
• Conditional statements
• Functions and much more
SASS and Ruby
• Ruby is required ONLY to install SASS.
SASS on Production?
• You need SASS only for your local development.
• SASS is not required to be configured on the SERVER
SASS and IE/Error handling
It works on IE and code will only lead to broken css on your page
.sass vs .scss
.sass
o came first
o different from the CSS syntax
o Forget the semicolons and parenthesis
.scss
o superset of CSS
o Syntax is same but with new features of SASS
o Semicolons and Parenthesis are required
Let’s Meet the SASS
Nesting {}
• SASS use the nested code.
• Nested code helps in making the code cleaner and
easier to read and maintain
• It helps in achieving DRY
Variables
• Container of the value
Scopes in Variables
• As any other language SASS also comes with the
scopes.
• Global and Local
Scopes in Variables
Local
!global
!default
• You can assign to variables if they aren’t already
assigned by adding the !default flag to the end of the
value. This means that if the variable has already
been assigned to, it won’t be re-assigned, but if it
doesn’t have a value yet, it will be given one.
Data types
• Numbers
• Strings
• Colors
• Boolean
• Null
• List
• Maps
SASS - Syntactically Awesome Stylesheet
@extend
• @extend helps in the inheritance of styling and helps
us in the repeating the code.
@extend Only (%)
• When you don’t want to repeat the css.
mixin
• Mixin are the most useful and powerful feature of the SASS
[Define, Include , arguments]
• It helps in making the repeated code declared once and use it
n number of times.
• You can have the mixin with arguments too, Defaults,
Varibales, maps, content, to mixin
mixin
Pros and Cons of Mixin
Pros:
o DRY approach
o Maintains the quality and consistency of the code
o Lot of complexity can be handle through the mixin
CONS:
o With each include of mixin new css is generated which leads to the lot of
duplicity of the code
o Could become little hard to maintain
& Operator
& in SASS refers to the current parent selector
#{} Interpolation
You can use variables in selectors & property names using #{}
@at-root
The @at-root directive causes one or more rules to be emitted at
the root of the document, rather than being nested beneath
their parent selectors
Best Practice
o Make a single file to create your variables
o Make a single file to create your mixin
o Make a single file to create Overloading of the libraries and 3rd party
plugin
o Make a single file to handle the structure of the website/Application
o Break the files into modules, pages etc
Other Frameworks
• LESS
• Stylus
References
o http://sass-lang.com/documentation

More Related Content

PPTX
PDF
Sass - Getting Started with Sass!
PPTX
Syntactically awesome stylesheets (Sass)
PPTX
Introduction to sass
ODP
Deep dive into sass
PPTX
SASS - CSS with Superpower
PDF
Intro to css & sass
PPTX
Introduction to SASS
Sass - Getting Started with Sass!
Syntactically awesome stylesheets (Sass)
Introduction to sass
Deep dive into sass
SASS - CSS with Superpower
Intro to css & sass
Introduction to SASS

What's hot (20)

PDF
Css Preprocessors
PPTX
PPSX
Introduction to css
PDF
Less vs sass
PPT
An Introduction to CSS Preprocessors (SASS & LESS)
PDF
CSS Best practice
PPTX
HTML CSS and Web Development
PDF
AEM Sightly Deep Dive
PDF
SVG - Scalable Vector Graphics
PPTX
Introduction to Tailwind CSS - IM Tech Meetup - May 2022.pptx
PDF
Flexbox and Grid Layout
PDF
Efficient, maintainable CSS
PPT
JDBC Java Database Connectivity
PDF
Redis
PPTX
Tailwind CSS.11.pptx
PPTX
Css pseudo-classes
PPTX
Page layout with css
PPTX
PPTX
Css backgrounds
PPTX
Redis
Css Preprocessors
Introduction to css
Less vs sass
An Introduction to CSS Preprocessors (SASS & LESS)
CSS Best practice
HTML CSS and Web Development
AEM Sightly Deep Dive
SVG - Scalable Vector Graphics
Introduction to Tailwind CSS - IM Tech Meetup - May 2022.pptx
Flexbox and Grid Layout
Efficient, maintainable CSS
JDBC Java Database Connectivity
Redis
Tailwind CSS.11.pptx
Css pseudo-classes
Page layout with css
Css backgrounds
Redis
Ad

Viewers also liked (14)

KEY
Intro to SASS CSS
PPTX
CSS3 Flex Layout
PPTX
Responsive Web design
PPTX
Introduction to Webcomponents
PDF
CSS Best Practices
PPT
Using scss-at-noisestreet
PDF
Getting Started With Sass | WC Philly 2015
PDF
Getting SASSy with front end development
PPTX
Sass: Introduction
PPTX
Post css - Getting start with PostCSS
PPTX
Progressive web apps
PDF
CSS3 secrets: 10 things you might not know about CSS3
PDF
Fundamental CSS3
PPTX
Reactjs
Intro to SASS CSS
CSS3 Flex Layout
Responsive Web design
Introduction to Webcomponents
CSS Best Practices
Using scss-at-noisestreet
Getting Started With Sass | WC Philly 2015
Getting SASSy with front end development
Sass: Introduction
Post css - Getting start with PostCSS
Progressive web apps
CSS3 secrets: 10 things you might not know about CSS3
Fundamental CSS3
Reactjs
Ad

Similar to SASS - Syntactically Awesome Stylesheet (20)

PPTX
Bliblidotcom - SASS Introduction
PDF
Css preprocessor-140606115334-phpapp01
PDF
CSS preprocessor: why and how
PPTX
The sass way - Yatendra Bhardwaj
PPTX
Sass - basic to advance
PDF
Sass that CSS
PDF
What is-sass-by-lucas-castro
PDF
Sass conferencia css-sp
PPTX
Sass_Cubet seminar
PPTX
Scss talk CSS Meetup
PPT
UNIT 3.ppt
PPTX
Sass:-Syntactically Awesome Stylesheet by Shafeeq
PDF
Malte Wessel - SASS Preprocessor / Compass / YDN Brand
PPTX
Styling your projects! leveraging css and r sass in r projects
PPTX
SCSS Implementation
PPTX
Yahoo7 Tech Night - SASS
PDF
Getting Sassy with CSS
PPTX
SASS is more than LESS
PDF
Using Sass in Your WordPress Projects
PPTX
Bliblidotcom - SASS Introduction
Css preprocessor-140606115334-phpapp01
CSS preprocessor: why and how
The sass way - Yatendra Bhardwaj
Sass - basic to advance
Sass that CSS
What is-sass-by-lucas-castro
Sass conferencia css-sp
Sass_Cubet seminar
Scss talk CSS Meetup
UNIT 3.ppt
Sass:-Syntactically Awesome Stylesheet by Shafeeq
Malte Wessel - SASS Preprocessor / Compass / YDN Brand
Styling your projects! leveraging css and r sass in r projects
SCSS Implementation
Yahoo7 Tech Night - SASS
Getting Sassy with CSS
SASS is more than LESS
Using Sass in Your WordPress Projects

Recently uploaded (20)

PPTX
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
PDF
cuic standard and advanced reporting.pdf
PPTX
A Presentation on Artificial Intelligence
PDF
Review of recent advances in non-invasive hemoglobin estimation
PDF
Agricultural_Statistics_at_a_Glance_2022_0.pdf
PDF
Advanced methodologies resolving dimensionality complications for autism neur...
PDF
NewMind AI Weekly Chronicles - August'25 Week I
PDF
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
PDF
Machine learning based COVID-19 study performance prediction
PDF
Reach Out and Touch Someone: Haptics and Empathic Computing
PPTX
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
PDF
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
PPTX
Cloud computing and distributed systems.
DOCX
The AUB Centre for AI in Media Proposal.docx
PDF
Approach and Philosophy of On baking technology
PPTX
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
PDF
Bridging biosciences and deep learning for revolutionary discoveries: a compr...
PDF
Dropbox Q2 2025 Financial Results & Investor Presentation
PDF
Mobile App Security Testing_ A Comprehensive Guide.pdf
PDF
Empathic Computing: Creating Shared Understanding
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
cuic standard and advanced reporting.pdf
A Presentation on Artificial Intelligence
Review of recent advances in non-invasive hemoglobin estimation
Agricultural_Statistics_at_a_Glance_2022_0.pdf
Advanced methodologies resolving dimensionality complications for autism neur...
NewMind AI Weekly Chronicles - August'25 Week I
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
Machine learning based COVID-19 study performance prediction
Reach Out and Touch Someone: Haptics and Empathic Computing
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
Cloud computing and distributed systems.
The AUB Centre for AI in Media Proposal.docx
Approach and Philosophy of On baking technology
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
Bridging biosciences and deep learning for revolutionary discoveries: a compr...
Dropbox Q2 2025 Financial Results & Investor Presentation
Mobile App Security Testing_ A Comprehensive Guide.pdf
Empathic Computing: Creating Shared Understanding

SASS - Syntactically Awesome Stylesheet

  • 1. SASS BY - Neha Sharma (nehha255@gmail.com) Syntactically Awesome Style Sheets
  • 2. AGENDA Part One – Introduction • What is SASS • Why we need SASS • SASS vs SCSS • Let’s meet the SASS Part Two – Syntax • Nesting • Variables and Scope • !default • !global • Data Types • @extend and @extend only • Mixins • & • Interpolation #{} • @at-root
  • 3. We love CSS It’s a question not a statement.
  • 4. CSS and Issues • Lot of CSS3 Vendor Prefixes • Repeated code • Changing value in single file is nightmare • Big team working on same and big css file is issue • No logic base styling
  • 5. What you want to change? Cleaner code, Logical Code, non-repeated code, less pain to write and maintain and much more…
  • 7. What is SASS? • Scripting language • Syntactically Awesome stylesheet • CSS Pre- Processor – Compile the SASS/SCSS files to CSS • Developed in 2007 • Full css3 compatible • Helps in writing clean, DRY-approach CSS
  • 8. Advantages of SASS • DRY – Don’t Repeat Yourself • Modules • Lots of features • Mathematical calculations • Conditional statements • Functions and much more
  • 9. SASS and Ruby • Ruby is required ONLY to install SASS.
  • 10. SASS on Production? • You need SASS only for your local development. • SASS is not required to be configured on the SERVER
  • 11. SASS and IE/Error handling It works on IE and code will only lead to broken css on your page
  • 12. .sass vs .scss .sass o came first o different from the CSS syntax o Forget the semicolons and parenthesis .scss o superset of CSS o Syntax is same but with new features of SASS o Semicolons and Parenthesis are required
  • 14. Nesting {} • SASS use the nested code. • Nested code helps in making the code cleaner and easier to read and maintain • It helps in achieving DRY
  • 16. Scopes in Variables • As any other language SASS also comes with the scopes. • Global and Local
  • 19. !default • You can assign to variables if they aren’t already assigned by adding the !default flag to the end of the value. This means that if the variable has already been assigned to, it won’t be re-assigned, but if it doesn’t have a value yet, it will be given one.
  • 20. Data types • Numbers • Strings • Colors • Boolean • Null • List • Maps
  • 22. @extend • @extend helps in the inheritance of styling and helps us in the repeating the code.
  • 23. @extend Only (%) • When you don’t want to repeat the css.
  • 24. mixin • Mixin are the most useful and powerful feature of the SASS [Define, Include , arguments] • It helps in making the repeated code declared once and use it n number of times. • You can have the mixin with arguments too, Defaults, Varibales, maps, content, to mixin
  • 25. mixin
  • 26. Pros and Cons of Mixin Pros: o DRY approach o Maintains the quality and consistency of the code o Lot of complexity can be handle through the mixin CONS: o With each include of mixin new css is generated which leads to the lot of duplicity of the code o Could become little hard to maintain
  • 27. & Operator & in SASS refers to the current parent selector
  • 28. #{} Interpolation You can use variables in selectors & property names using #{}
  • 29. @at-root The @at-root directive causes one or more rules to be emitted at the root of the document, rather than being nested beneath their parent selectors
  • 30. Best Practice o Make a single file to create your variables o Make a single file to create your mixin o Make a single file to create Overloading of the libraries and 3rd party plugin o Make a single file to handle the structure of the website/Application o Break the files into modules, pages etc