SlideShare a Scribd company logo
SCSS Hacks
Caleb
Who I am
Content Outline
❏ What is SCSS
❏ Using SCSS in Visual Studio Code
❏ Linking SASS to Html
❏ SASS Variable
❏ Extending/ Inheritance
❏ Operators
❏ Mixins
❏ Import
❏ Demo
SCSS
“ Sassy Cascading Style Sheets (SCSS) uses block formatting like that of CSS. It
uses braces to denote code blocks and semicolons to separate lines within a
block. The indented syntax and SCSS files are traditionally given the extensions
.sass and .scss, respectively. “
Integrating SCSS with IDE (VS Code)
❏ 1. Install a SASS or Less Transpiler. Use either the Node-sass or less node.js
module
npm install -g node-sass less
❏ 2. Create a simple SASS or Less File
❏ 3. Create Tasks.json file
❏ 4. Run the build task.
Linking SCSS to Html file
<link rel="stylesheet/less" type="text/css" href="styles.less" /> <script
src="less.js" type="text/javascript"></script>
- Adding these 2 lines of code to link the less stylesheet to the html file.
Variables in SCSS (1)
❖ Variable names in SCSS start with $
❖ A variable declaration looks a lot like a property declaration: it’s written
<variable>: <expression>.
❖ Sass variables are imperative, which means if you use a variable and then
change its value, the earlier use will stay the same
Variables in SCSS (2)
❖ Sass variables, like all Sass identifiers, treat hyphens and
underscores as identical
❖ Sass provides the !default flag. This assigns a value to a variable
only if that variable isn’t defined or its value is null. Otherwise, the
existing value will be used. This way, users can set variables
before they import your library to customize its behavior.
Variables in SCSS (3)
❖ Variables declared at the top of a style sheet are global (Scoping)
❖ If you need to set a global variable’s value from within a local scope (such
as in a mixin), you can use the !global flag. A variable declaration flagged
as !global will always assign to the global scope. It cannot be used to
declare a new variable.
❖ The variable-exists() function returns whether a variable with the given
name exists in the current scope, and the global-variable-exists() function
does the same but only for the global scope.
SCSS (Extending/Inheritance)
Using @extend lets you share a set of CSS properties from one selector to
another.
Operators
❏ Colon : operator to define a variable. E.g.: $main-color: blue; (assigning a
color)
❏ Addition (+) operator can be used to concatenate string
❏ Equality Operator ( == ) can be used to test the type of the $font argument.
❏ Modulus Operator (&) can set the property of an element by evaluating an
expression
❏ Comparison Operator can be used to compare numbers
❏ Logical Operators allow us to test multiple conditions within a conditional
expression.
❏ Addition Operator allows us to concatenate strings.
Mixins
❏ Adding groups of CSS Declarations to reuse in a website.
❏ Values are passed in to make mixins more flexible.
❏ To create a mixin, use a @mixin declaration and name the mixin.
❏ A variable $property can be used for us to pass in our mixin of whatever
effects we want to achieve.
❏ After creating the mixin, we can use it as a CSS declaration starting with
@include.
Import (1)
Combine imported file and target file to only render a single CSS file onto the
browser.
Renders your page directly (multiple http requests in internet browsers in CSS)
// styles.scss example of import
@import ‘home/code’, ‘home/lists’;
- Mixins, Variables and functions from file are made available and all its
CSS is made available when the @import is declared.
.
Import (2)
SCSS imports file by URL, not by file path.
Users provide load path on implementation of imports.
Imports are always resolved relative to the current file first though. Load paths
are used only if the files imported are not found.
Advantages
©: KatikeK on Codepen
Advantages
Final Tips
“ SCSS is only powerful when you use a CSS preprocessor to convert SCSS files
to CSS files. CSS files determine how your website look. “
More Reading
1. Theming with SASS: An SCSS Tutorial by Fernando Rivas
2. SASS Documentation on SASS-lang website
3. SASS Guidelines by Hugo Giraudel (https://sass-guidelin.es)
4. 10+ Best Tools and Resources to Compile & Manage SASS, LESS, and Stylus
– CSS Preprocessors by Taisiya (Graygrids Article)
5. Leaner Style Sheet (LESS) documentation (http://lesscss.org/)
6. Custom Importers of node-sass (https://sass-lang.com/documentation/at-
rules/import)

More Related Content

What's hot (7)

PDF
High Performance Front-End Development
drywallbmb
 
PDF
Drag and drop file upload with Dropzone in CodeIgniter
Yogesh singh
 
PPTX
Internet and Web Technology (CLASS-14) [JSP] | NIC/NIELIT Web Technology
Ayes Chinmay
 
PPTX
Less css
Amit kumar
 
DOCX
Node js getting started
Pallavi Srivastava
 
PPTX
What's a web page made of?
Charlie Allen
 
PPT
Documentation for installing swizzard cms
Gary Dragul
 
High Performance Front-End Development
drywallbmb
 
Drag and drop file upload with Dropzone in CodeIgniter
Yogesh singh
 
Internet and Web Technology (CLASS-14) [JSP] | NIC/NIELIT Web Technology
Ayes Chinmay
 
Less css
Amit kumar
 
Node js getting started
Pallavi Srivastava
 
What's a web page made of?
Charlie Allen
 
Documentation for installing swizzard cms
Gary Dragul
 

Similar to Scss talk CSS Meetup (20)

PPTX
Web technologies-course 05.pptx
Stefan Oprea
 
PDF
CSS preprocessor: why and how
mirahman
 
PDF
Css preprocessor-140606115334-phpapp01
Anam Hossain
 
PPTX
Syntactically awesome stylesheets (Sass)
Tahmina Khatoon
 
PPTX
SCSS Implementation
Amey Parab
 
PPT
UNIT 3.ppt
kavi806657
 
PPTX
Bliblidotcom - SASS Introduction
Irfan Maulana
 
ODP
Deep dive into sass
Knoldus Inc.
 
PPTX
Sass
Tayseer_Emam
 
PPTX
SASS - Syntactically Awesome Stylesheet
Neha Sharma
 
PPTX
Joes sass presentation
JoeSeckelman
 
PPTX
Sass_Cubet seminar
Cubet Techno Labs
 
PPTX
The sass way - Yatendra Bhardwaj
Yatendra Bhardwaj
 
PDF
Sass conferencia css-sp
Lourdes Montano
 
PPTX
SASS is more than LESS
Itai Koren
 
PDF
Atlanta Drupal User's Group - April 2015 - Sasstronauts: Advanced Sass Topics
Eric Sembrat
 
PDF
Assembling Sass
Hossain Mohammad Samrat
 
PDF
Sass that CSS
Trish Ang
 
PDF
Using Sass in Your WordPress Projects
Jeremy Green
 
PPTX
sass_part2
BalaKrishna Kolliboina
 
Web technologies-course 05.pptx
Stefan Oprea
 
CSS preprocessor: why and how
mirahman
 
Css preprocessor-140606115334-phpapp01
Anam Hossain
 
Syntactically awesome stylesheets (Sass)
Tahmina Khatoon
 
SCSS Implementation
Amey Parab
 
UNIT 3.ppt
kavi806657
 
Bliblidotcom - SASS Introduction
Irfan Maulana
 
Deep dive into sass
Knoldus Inc.
 
SASS - Syntactically Awesome Stylesheet
Neha Sharma
 
Joes sass presentation
JoeSeckelman
 
Sass_Cubet seminar
Cubet Techno Labs
 
The sass way - Yatendra Bhardwaj
Yatendra Bhardwaj
 
Sass conferencia css-sp
Lourdes Montano
 
SASS is more than LESS
Itai Koren
 
Atlanta Drupal User's Group - April 2015 - Sasstronauts: Advanced Sass Topics
Eric Sembrat
 
Assembling Sass
Hossain Mohammad Samrat
 
Sass that CSS
Trish Ang
 
Using Sass in Your WordPress Projects
Jeremy Green
 
Ad

Recently uploaded (20)

PDF
Next Generation AI: Anticipatory Intelligence, Forecasting Inflection Points ...
dleka294658677
 
PPTX
Essential Content-centric Plugins for your Website
Laura Byrne
 
PDF
“Computer Vision at Sea: Automated Fish Tracking for Sustainable Fishing,” a ...
Edge AI and Vision Alliance
 
DOCX
Cryptography Quiz: test your knowledge of this important security concept.
Rajni Bhardwaj Grover
 
PDF
Book industry state of the nation 2025 - Tech Forum 2025
BookNet Canada
 
PDF
Go Concurrency Real-World Patterns, Pitfalls, and Playground Battles.pdf
Emily Achieng
 
PDF
NLJUG Speaker academy 2025 - first session
Bert Jan Schrijver
 
DOCX
Python coding for beginners !! Start now!#
Rajni Bhardwaj Grover
 
PDF
Modern Decentralized Application Architectures.pdf
Kalema Edgar
 
PPTX
Mastering ODC + Okta Configuration - Chennai OSUG
HathiMaryA
 
PDF
🚀 Let’s Build Our First Slack Workflow! 🔧.pdf
SanjeetMishra29
 
PDF
What’s my job again? Slides from Mark Simos talk at 2025 Tampa BSides
Mark Simos
 
PDF
“NPU IP Hardware Shaped Through Software and Use-case Analysis,” a Presentati...
Edge AI and Vision Alliance
 
PPTX
Agentforce World Tour Toronto '25 - MCP with MuleSoft
Alexandra N. Martinez
 
PDF
Bharatiya Antariksh Hackathon 2025 Idea Submission PPT.pdf
ghjghvhjgc
 
PPTX
Talbott's brief History of Computers for CollabDays Hamburg 2025
Talbott Crowell
 
PDF
UPDF - AI PDF Editor & Converter Key Features
DealFuel
 
PDF
ICONIQ State of AI Report 2025 - The Builder's Playbook
Razin Mustafiz
 
PDF
[GDGoC FPTU] Spring 2025 Summary Slidess
minhtrietgect
 
PDF
Home Cleaning App Development Services.pdf
V3cube
 
Next Generation AI: Anticipatory Intelligence, Forecasting Inflection Points ...
dleka294658677
 
Essential Content-centric Plugins for your Website
Laura Byrne
 
“Computer Vision at Sea: Automated Fish Tracking for Sustainable Fishing,” a ...
Edge AI and Vision Alliance
 
Cryptography Quiz: test your knowledge of this important security concept.
Rajni Bhardwaj Grover
 
Book industry state of the nation 2025 - Tech Forum 2025
BookNet Canada
 
Go Concurrency Real-World Patterns, Pitfalls, and Playground Battles.pdf
Emily Achieng
 
NLJUG Speaker academy 2025 - first session
Bert Jan Schrijver
 
Python coding for beginners !! Start now!#
Rajni Bhardwaj Grover
 
Modern Decentralized Application Architectures.pdf
Kalema Edgar
 
Mastering ODC + Okta Configuration - Chennai OSUG
HathiMaryA
 
🚀 Let’s Build Our First Slack Workflow! 🔧.pdf
SanjeetMishra29
 
What’s my job again? Slides from Mark Simos talk at 2025 Tampa BSides
Mark Simos
 
“NPU IP Hardware Shaped Through Software and Use-case Analysis,” a Presentati...
Edge AI and Vision Alliance
 
Agentforce World Tour Toronto '25 - MCP with MuleSoft
Alexandra N. Martinez
 
Bharatiya Antariksh Hackathon 2025 Idea Submission PPT.pdf
ghjghvhjgc
 
Talbott's brief History of Computers for CollabDays Hamburg 2025
Talbott Crowell
 
UPDF - AI PDF Editor & Converter Key Features
DealFuel
 
ICONIQ State of AI Report 2025 - The Builder's Playbook
Razin Mustafiz
 
[GDGoC FPTU] Spring 2025 Summary Slidess
minhtrietgect
 
Home Cleaning App Development Services.pdf
V3cube
 
Ad

Scss talk CSS Meetup

  • 3. Content Outline ❏ What is SCSS ❏ Using SCSS in Visual Studio Code ❏ Linking SASS to Html ❏ SASS Variable ❏ Extending/ Inheritance ❏ Operators ❏ Mixins ❏ Import ❏ Demo
  • 4. SCSS “ Sassy Cascading Style Sheets (SCSS) uses block formatting like that of CSS. It uses braces to denote code blocks and semicolons to separate lines within a block. The indented syntax and SCSS files are traditionally given the extensions .sass and .scss, respectively. “
  • 5. Integrating SCSS with IDE (VS Code) ❏ 1. Install a SASS or Less Transpiler. Use either the Node-sass or less node.js module npm install -g node-sass less ❏ 2. Create a simple SASS or Less File ❏ 3. Create Tasks.json file ❏ 4. Run the build task.
  • 6. Linking SCSS to Html file <link rel="stylesheet/less" type="text/css" href="styles.less" /> <script src="less.js" type="text/javascript"></script> - Adding these 2 lines of code to link the less stylesheet to the html file.
  • 7. Variables in SCSS (1) ❖ Variable names in SCSS start with $ ❖ A variable declaration looks a lot like a property declaration: it’s written <variable>: <expression>. ❖ Sass variables are imperative, which means if you use a variable and then change its value, the earlier use will stay the same
  • 8. Variables in SCSS (2) ❖ Sass variables, like all Sass identifiers, treat hyphens and underscores as identical ❖ Sass provides the !default flag. This assigns a value to a variable only if that variable isn’t defined or its value is null. Otherwise, the existing value will be used. This way, users can set variables before they import your library to customize its behavior.
  • 9. Variables in SCSS (3) ❖ Variables declared at the top of a style sheet are global (Scoping) ❖ If you need to set a global variable’s value from within a local scope (such as in a mixin), you can use the !global flag. A variable declaration flagged as !global will always assign to the global scope. It cannot be used to declare a new variable. ❖ The variable-exists() function returns whether a variable with the given name exists in the current scope, and the global-variable-exists() function does the same but only for the global scope.
  • 10. SCSS (Extending/Inheritance) Using @extend lets you share a set of CSS properties from one selector to another.
  • 11. Operators ❏ Colon : operator to define a variable. E.g.: $main-color: blue; (assigning a color) ❏ Addition (+) operator can be used to concatenate string ❏ Equality Operator ( == ) can be used to test the type of the $font argument. ❏ Modulus Operator (&) can set the property of an element by evaluating an expression ❏ Comparison Operator can be used to compare numbers ❏ Logical Operators allow us to test multiple conditions within a conditional expression. ❏ Addition Operator allows us to concatenate strings.
  • 12. Mixins ❏ Adding groups of CSS Declarations to reuse in a website. ❏ Values are passed in to make mixins more flexible. ❏ To create a mixin, use a @mixin declaration and name the mixin. ❏ A variable $property can be used for us to pass in our mixin of whatever effects we want to achieve. ❏ After creating the mixin, we can use it as a CSS declaration starting with @include.
  • 13. Import (1) Combine imported file and target file to only render a single CSS file onto the browser. Renders your page directly (multiple http requests in internet browsers in CSS) // styles.scss example of import @import ‘home/code’, ‘home/lists’; - Mixins, Variables and functions from file are made available and all its CSS is made available when the @import is declared. .
  • 14. Import (2) SCSS imports file by URL, not by file path. Users provide load path on implementation of imports. Imports are always resolved relative to the current file first though. Load paths are used only if the files imported are not found.
  • 17. Final Tips “ SCSS is only powerful when you use a CSS preprocessor to convert SCSS files to CSS files. CSS files determine how your website look. “
  • 18. More Reading 1. Theming with SASS: An SCSS Tutorial by Fernando Rivas 2. SASS Documentation on SASS-lang website 3. SASS Guidelines by Hugo Giraudel (https://sass-guidelin.es) 4. 10+ Best Tools and Resources to Compile & Manage SASS, LESS, and Stylus – CSS Preprocessors by Taisiya (Graygrids Article) 5. Leaner Style Sheet (LESS) documentation (http://lesscss.org/) 6. Custom Importers of node-sass (https://sass-lang.com/documentation/at- rules/import)

Editor's Notes

  • #6: Reference: https://code.visualstudio.com/docs/languages/css
  • #7: http://lesscss.org/ https://stackoverflow.com/questions/19215517/attaching-a-sass-scss-to-html-docs
  • #8: https://sass-lang.com/documentation/variables
  • #9: https://sass-lang.com/documentation/variables
  • #10: https://sass-lang.com/documentation/variables
  • #12: Reference: https://www.sitepoint.com/sass-basics-operators/
  • #14: https://sass-lang.com/documentation/at-rules/import