SlideShare une entreprise Scribd logo
1  sur  32
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
@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

Contenu connexe

Tendances

Introduction to css
Introduction to cssIntroduction to css
Introduction to css
eShikshak
 

Tendances (20)

Sass
SassSass
Sass
 
CSS Mastigado
CSS MastigadoCSS Mastigado
CSS Mastigado
 
Less vs sass
Less vs sassLess vs sass
Less vs sass
 
CSS - OOCSS, SMACSS and more
CSS - OOCSS, SMACSS and moreCSS - OOCSS, SMACSS and more
CSS - OOCSS, SMACSS and more
 
Css to-scss
Css to-scssCss to-scss
Css to-scss
 
Less presentation
Less presentationLess presentation
Less presentation
 
CSS For Backend Developers
CSS For Backend DevelopersCSS For Backend Developers
CSS For Backend Developers
 
CSS FLexBox
CSS FLexBoxCSS FLexBox
CSS FLexBox
 
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)
 
How Cascading Style Sheets (CSS) Works
How Cascading Style Sheets (CSS) WorksHow Cascading Style Sheets (CSS) Works
How Cascading Style Sheets (CSS) Works
 
Beginners css tutorial for web designers
Beginners css tutorial for web designersBeginners css tutorial for web designers
Beginners css tutorial for web designers
 
Introduction to css
Introduction to cssIntroduction to css
Introduction to css
 
CSS
CSSCSS
CSS
 
Introduction to CSS3
Introduction to CSS3Introduction to CSS3
Introduction to CSS3
 
Welcome to Blazor
Welcome to BlazorWelcome to Blazor
Welcome to Blazor
 
CSS Day: CSS Grid Layout
CSS Day: CSS Grid Layout CSS Day: CSS Grid Layout
CSS Day: CSS Grid Layout
 
HTML5, CSS, JavaScript Style guide and coding conventions
HTML5, CSS, JavaScript Style guide and coding conventionsHTML5, CSS, JavaScript Style guide and coding conventions
HTML5, CSS, JavaScript Style guide and coding conventions
 
Introduction to Cascading Style Sheets (CSS)
Introduction to Cascading Style Sheets (CSS)Introduction to Cascading Style Sheets (CSS)
Introduction to Cascading Style Sheets (CSS)
 
Intro to Flexbox - A Magical CSS Property
Intro to Flexbox - A Magical CSS PropertyIntro to Flexbox - A Magical CSS Property
Intro to Flexbox - A Magical CSS Property
 
HTML CSS Basics
HTML CSS BasicsHTML CSS Basics
HTML CSS Basics
 

En vedette

Using scss-at-noisestreet
Using scss-at-noisestreetUsing scss-at-noisestreet
Using scss-at-noisestreet
Wei Pin Teo
 

En vedette (14)

Intro to SASS CSS
Intro to SASS CSSIntro to SASS CSS
Intro to SASS CSS
 
CSS3 Flex Layout
CSS3 Flex LayoutCSS3 Flex Layout
CSS3 Flex Layout
 
Responsive Web design
Responsive Web designResponsive Web design
Responsive Web design
 
Introduction to Webcomponents
Introduction to WebcomponentsIntroduction to Webcomponents
Introduction to Webcomponents
 
CSS Best Practices
CSS Best PracticesCSS Best Practices
CSS Best Practices
 
Using scss-at-noisestreet
Using scss-at-noisestreetUsing scss-at-noisestreet
Using scss-at-noisestreet
 
Getting Started With Sass | WC Philly 2015
Getting Started With Sass | WC Philly 2015Getting Started With Sass | WC Philly 2015
Getting Started With Sass | WC Philly 2015
 
Getting SASSy with front end development
Getting SASSy with front end developmentGetting SASSy with front end development
Getting SASSy with front end development
 
Sass: Introduction
Sass: IntroductionSass: Introduction
Sass: Introduction
 
Post css - Getting start with PostCSS
Post css - Getting start with PostCSSPost css - Getting start with PostCSS
Post css - Getting start with PostCSS
 
Progressive web apps
 Progressive web apps Progressive web apps
Progressive web apps
 
CSS3 secrets: 10 things you might not know about CSS3
CSS3 secrets: 10 things you might not know about CSS3CSS3 secrets: 10 things you might not know about CSS3
CSS3 secrets: 10 things you might not know about CSS3
 
Fundamental CSS3
Fundamental CSS3Fundamental CSS3
Fundamental CSS3
 
Reactjs
Reactjs Reactjs
Reactjs
 

Similaire à SASS - Syntactically Awesome Stylesheet

The sass way - Yatendra Bhardwaj
The sass way - Yatendra BhardwajThe sass way - Yatendra Bhardwaj
The sass way - Yatendra Bhardwaj
Yatendra Bhardwaj
 

Similaire à SASS - Syntactically Awesome Stylesheet (20)

Sass:-Syntactically Awesome Stylesheet by Shafeeq
Sass:-Syntactically Awesome Stylesheet by ShafeeqSass:-Syntactically Awesome Stylesheet by Shafeeq
Sass:-Syntactically Awesome Stylesheet by Shafeeq
 
Sass - basic to advance
Sass  - basic to advanceSass  - basic to advance
Sass - basic to advance
 
What is-sass-by-lucas-castro
What is-sass-by-lucas-castroWhat is-sass-by-lucas-castro
What is-sass-by-lucas-castro
 
SCSS Implementation
SCSS ImplementationSCSS Implementation
SCSS Implementation
 
Bliblidotcom - SASS Introduction
Bliblidotcom - SASS IntroductionBliblidotcom - SASS Introduction
Bliblidotcom - SASS Introduction
 
Less
LessLess
Less
 
The sass way - Yatendra Bhardwaj
The sass way - Yatendra BhardwajThe sass way - Yatendra Bhardwaj
The sass way - Yatendra Bhardwaj
 
DRY CSS A don’t-repeat-yourself methodology for creating efficient, unified a...
DRY CSS A don’t-repeat-yourself methodology for creating efficient, unified a...DRY CSS A don’t-repeat-yourself methodology for creating efficient, unified a...
DRY CSS A don’t-repeat-yourself methodology for creating efficient, unified a...
 
UNIT 3.ppt
UNIT 3.pptUNIT 3.ppt
UNIT 3.ppt
 
Web technologies-course 05.pptx
Web technologies-course 05.pptxWeb technologies-course 05.pptx
Web technologies-course 05.pptx
 
A forest of designs without subthemes
A forest of designs without subthemesA forest of designs without subthemes
A forest of designs without subthemes
 
European SharePoint Webinar - Make SharePoint Sassy
European SharePoint Webinar - Make SharePoint SassyEuropean SharePoint Webinar - Make SharePoint Sassy
European SharePoint Webinar - Make SharePoint Sassy
 
WordCamp NYC - DRY CSS
WordCamp NYC - DRY CSSWordCamp NYC - DRY CSS
WordCamp NYC - DRY CSS
 
4. Web Technology CSS Basics-1
4. Web Technology CSS Basics-14. Web Technology CSS Basics-1
4. Web Technology CSS Basics-1
 
Intro to Sass for WordPress Developers
Intro to Sass for WordPress DevelopersIntro to Sass for WordPress Developers
Intro to Sass for WordPress Developers
 
Advanced sass/compass
Advanced sass/compassAdvanced sass/compass
Advanced sass/compass
 
SPS Oslo - Stop your SharePoint CSS becoming a di-sass-ter today!
SPS Oslo - Stop your SharePoint CSS becoming a di-sass-ter today!SPS Oslo - Stop your SharePoint CSS becoming a di-sass-ter today!
SPS Oslo - Stop your SharePoint CSS becoming a di-sass-ter today!
 
Joes sass presentation
Joes sass presentationJoes sass presentation
Joes sass presentation
 
Using Sass in Your WordPress Projects
Using Sass in Your WordPress ProjectsUsing Sass in Your WordPress Projects
Using Sass in Your WordPress Projects
 
Universal CSS - Betsy Granger - ebookcraft 2018
Universal CSS - Betsy Granger - ebookcraft 2018Universal CSS - Betsy Granger - ebookcraft 2018
Universal CSS - Betsy Granger - ebookcraft 2018
 

Dernier

Dernier (20)

08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
 
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...
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
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
 
Tech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdfTech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdf
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
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
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
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...
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
Evaluating the top large language models.pdf
Evaluating the top large language models.pdfEvaluating the top large language models.pdf
Evaluating the top large language models.pdf
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 
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
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024
 

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
  • 21.
  • 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