Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
A Modern Sass Architecture
Search
Stuart Robson
May 06, 2015
Design
540
7
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
A Modern Sass Architecture
A short talk I gave at the inaugural SassXSW in Bath on MAy 6th 2015
Stuart Robson
May 06, 2015
Transcript
77 slides
Modern Architecture
[email protected]
None
[email protected]
None
None
None
None
None
None
None
None
None
None
None
None
None
None
None
None
None
None
None
None
What is a page?
We’re not building mom & pop shops anymore
OOCSS
BEM
SMACSS
ITCSS
None
Folders & Files - ageddon
7 folders, to rule them all
None
base/
base/ • where you put rudimentary defaults • a reset
file • basic typography settings • code for common HTML elements
None
layouts/
layouts/ • code that lays out the site • code
for the main ‘parts’ of your site • header • footer • main • aside
None
components/
components/ • smaller parts of the site • a carousel
(if they’re not evil, are they evil?) • accordian • tabs
None
pages/
pages/ • for ‘page specific’ code • files named after
the ‘page’ e.g. • _front-page.scss
None
themes/
themes/ • ‘big sites’ might need slight differences for different
states or themes
None
config/
config/ • code that doesn’t output CSS • tools and
helpers • mixins • variables • functions
None
vendor/
vendor/ • a good store for ‘not my code’ •
CSS from external libraries • jquery-ui.scss • bootstrap.scss
None
config/
|– config/ | |– _variables.scss | |– _functions.scss | |–
_mixins.scss | |– _helpers.scss
None
_variables.scss
866 lines of variables
None
// Default Variables // -------------------- $brand-color--primary: #C69; $brand-color--secondary: #699; $brand-color--tertiary:
#F2ECE4; ...
// Tabs Pattern // ------------------- $tabs-navigation-border-color: $brand-color--secondary; $tabs-navigation-text-color: $brand-color--tertiary; $tabs-main-background-color:
$white; ...
None
None
_shame.scss • somewhere to put something you’re not sure of
• should still have comments • should be emptied routinely, and quickly
None
file naming convention _b-reset.scss base files begin with _b- _c-tabs.scss
components begin with _c- _l-header.scss layout files begin with _l- _p-contact.scss page files begin with _p- _t-admin.scss theme files begin with _t- _v-neat.scss vendor files begin with _v-
@import - irasation
// config/ @import "config/_variables"; … // base/ @import "base/_reset"; ...
// components/ @import "components/_buttons"; ... // layout/ @import "layout/_navigation"; ... // pages/ @import "pages/_home"; ... // themes/ @import “themes/_logged-in“; ... // vendors/ @import "config/_jquery-ui"; ...
How To Write Your Sass?
.component { // extends // includes // variables // CSS
// parent selector items // media queries }
https://speakerdeck.com/onishiweb/taking-the-pain-out-of-refactoring-secwed-march
Never go four levels deep
http://sass-guidelin.es/
Modern Architecture
wrapping up • keep your Sass sane • use specific
folders for specific elements of a site • refactor when you can • add comments like a mad person
More Decks by Stuart Robson
See All by Stuart Robson
L-I-V-I-N
sturobson
2
760
A Modern Sass Artchitecture
sturobson
11
2.3k
Cutting Edge Sass - Sass Summit 2014
sturobson
5
500
100% Pure Sass
sturobson
1
340
Make Your Code Delicious - From the Front, Italy 2014
sturobson
4
1.4k
Freelancing: One year done.
sturobson
0
1.4k
Sass: a whistle stop tour
sturobson
1
890
Sass: An Introduction
sturobson
0
300
make your code delicious
sturobson
2
760
Other Decks in Design
See All in Design
Pra não dizer que não falei das flores...
videlvequio
0
170
From Desktop to Spatial Interfaces UX Design Implications of Evolving Interaction Paradigms
hcrane
0
150
UNION TEC GROUP | 2026' Project Portfolio
uniontec2000
0
170
デザイン組織の"次の"強みづくり
isaikaori
2
380
AI-DLC AI駆動開発ライフサイクルとAI-DLC Worlflows V2のご紹介
fatsushi
4
2.4k
設計の進め方と 品質特性品質特性
harakeishi
0
1.5k
Jun Wei | Information Design & Presentation Portfolio
wjw100788
PRO
0
250
20260802東京都市大学オープンキャンパス授業
a2k
0
130
デザインレビューを「他者へのおすそわけ」に再定義し、たのしい場にする試み
webnaut
2
200
凡庸を落とすハーネス
hiromimaeo
2
1.1k
デザイナーがいない部署にハーネスを設計する
kenichiota0711
5
6.1k
信頼をデザインし、ブランドで市場を拓く。/ Designship2026
assuredjp
PRO
0
300
Featured
See All Featured
How to Think Like a Performance Engineer
csswizardry
28
2.9k
Six Lessons from altMBA
skipperchong
29
4.6k
[RailsConf 2023 Opening Keynote] The Magic of Rails
eileencodes
31
10k
Agile that works and the tools we love
rasmusluckow
331
22k
Building Better People: How to give real-time feedback that sticks.
wjessup
371
20k
How to make the Groovebox
asonas
2
2.6k
DevOps and Value Stream Thinking: Enabling flow, efficiency and business value
helenjbeal
2
450
[RailsConf 2023] Rails as a piece of cake
palkan
59
7.2k
The Straight Up "How To Draw Better" Workshop
denniskardys
239
140k
Self-Hosted WebAssembly Runtime for Runtime-Neutral Checkpoint/Restore in Edge–Cloud Continuum
chikuwait
0
960
Build The Right Thing And Hit Your Dates
maggiecrowley
39
3.5k
Java REST API Framework Comparison - PWX 2021
mraible
34
9.8k