Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
HowAboutWe for Couples Views & Styles Patterns
Search
Rebecca Miller-Webster
March 27, 2013
Programming
0
69
HowAboutWe for Couples Views & Styles Patterns
in Rails
Rebecca Miller-Webster
March 27, 2013
Tweet
Share
More Decks by Rebecca Miller-Webster
See All by Rebecca Miller-Webster
Refactoring Trust on Your Teams (GOTO; Chicago 2020)
rmw
34
3.1k
Trust & Teams: 2019 Chicago CTO Summit
rmw
2
300
Refactoring Trust on Your Team (CTO Summit 2018)
rmw
1
1.4k
Trust and Teams: GORUCO 2017
rmw
0
240
Becoming an Engineer Leader Panel Intro Slide
rmw
0
300
Frameworks for Feedback (Long version) - 2016 May Self Conference
rmw
2
910
Frameworks for Feedback (2015 May - RailsConf)
rmw
1
500
Frameworks for Feedback - DevOpsDays Chicago
rmw
0
910
Tech Talk 101: Topic Generation
rmw
0
380
Other Decks in Programming
See All in Programming
Porting a visionOS App to Android XR
akkeylab
0
660
VS Code Update for GitHub Copilot
74th
2
670
顧客の画像データをテラバイト単位で配信する 画像サーバを WebP にした際に起こった課題と その対応策 ~継続的な取り組みを添えて~
takutakahashi
1
310
効率的な開発手段として VRTを活用する
ishkawa
0
150
CDK引数設計道場100本ノック
badmintoncryer
2
360
Modern Angular with Signals and Signal Store:New Rules for Your Architecture @enterJS Advanced Angular Day 2025
manfredsteyer
PRO
0
240
AIエージェントはこう育てる - GitHub Copilot Agentとチームの共進化サイクル
koboriakira
0
620
The Modern View Layer Rails Deserves: A Vision For 2025 And Beyond @ RailsConf 2025, Philadelphia, PA
marcoroth
2
670
Flutterで備える!Accessibility Nutrition Labels完全ガイド
yuukiw00w
0
170
PHPで始める振る舞い駆動開発(Behaviour-Driven Development)
ohmori_yusuke
2
420
脱Riverpod?fqueryで考える、TanStack Queryライクなアーキテクチャの可能性
ostk0069
0
340
新メンバーも今日から大活躍!SREが支えるスケールし続ける組織のオンボーディング
honmarkhunt
5
8.2k
Featured
See All Featured
KATA
mclloyd
30
14k
Speed Design
sergeychernyshev
32
1k
How GitHub (no longer) Works
holman
314
140k
Design and Strategy: How to Deal with People Who Don’t "Get" Design
morganepeng
130
19k
Building Better People: How to give real-time feedback that sticks.
wjessup
367
19k
A better future with KSS
kneath
238
17k
Responsive Adventures: Dirty Tricks From The Dark Corners of Front-End
smashingmag
251
21k
What's in a price? How to price your products and services
michaelherold
246
12k
jQuery: Nuts, Bolts and Bling
dougneiner
63
7.8k
Principles of Awesome APIs and How to Build Them.
keavy
126
17k
Side Projects
sachag
455
42k
The Success of Rails: Ensuring Growth for the Next 100 Years
eileencodes
45
7.5k
Transcript
Overview of Couples Views/Styles HowAboutWe Server 1 pointer March 26,
2013
• logic in views is harder to test • views
are difficult to reason about Problem: Our Views are messy WTF is happening here??
Fix #0: SASS and View Styleguide! https://github.com/howaboutwe/sass-style-guide
NOT DESIGN Markup is about content
None
Use SASS THE GOOD PARTS
None
Variables are your friend
Mixin it up ... WITH
Decorators & Helpers WHEN SHIT GETS COMPLICATED
Decorators Logic moves with the OBJECT Helpers Logic moves with
the VIEW
Move logic out of views When • if statements •
ternary • lots of states • It hurts my head Then Generate in (testable) code • Classes • Copy • Html attributes
This
TO
How?
Generate classes
Move classes up
None
Generate Copy
Encapsulate repetition in partials Sometimes zero Sometimes one Sometimes two
None
Generate html attributes From TO WITH
Our current pattern • Use & enforce styleguide for SASS
& views • Markup is about content not design • Use SASS ◦ variables ◦ mixins • Move classes up & design changes to CSS • Use decorators (or helpers) to: ◦ Generate classes ◦ Generate copy ◦ Generate HTML attributes