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
54
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
25
2.3k
Trust & Teams: 2019 Chicago CTO Summit
rmw
2
170
Refactoring Trust on Your Team (CTO Summit 2018)
rmw
1
1k
Trust and Teams: GORUCO 2017
rmw
0
150
Becoming an Engineer Leader Panel Intro Slide
rmw
0
170
Frameworks for Feedback (Long version) - 2016 May Self Conference
rmw
2
610
Frameworks for Feedback (2015 May - RailsConf)
rmw
1
380
Frameworks for Feedback - DevOpsDays Chicago
rmw
0
790
Tech Talk 101: Topic Generation
rmw
0
270
Other Decks in Programming
See All in Programming
Compose-View Interop in Practice (mDevCamp 2024)
stewemetal
0
140
VSCodeでのDatabricks開発もお勧めしたい/I would also recommend Databricks development with VSCode.
kazumain
0
260
Snowflakeで眠ったデータを起こそう!
estie
0
120
dbtのドメイン分割による データ基盤の改善とDigdagとの連携
sakama
0
350
Azure OpenAI Serviceのプロンプトエンジニアリング入門
tomokusaba
3
710
効率化に挑戦してみたらモバイル開発が少し快適になった話
ryunakayama
0
130
GitHub Actionsで泣かないためにやっておきたい設定 / Recommended GHA settings to avoid crying
pinkumohikan
3
540
MetricKitで予期せぬ終了を検知する話 / Detect unexpected termination with MetricKit
nekowen
1
190
Prepare for Jakarta EE 11 - Performance and Developer Productivity
ivargrimstad
0
810
Site Reliability Engineering for GMO
pyama86
8
1k
TCAとKMPを用いた新規動画配信アプリ 「ABEMA Live」の設計
tomu28
1
110
Hanami and htmx
bkuhlmann
0
210
Featured
See All Featured
Writing Fast Ruby
sferik
621
60k
Fantastic passwords and where to find them - at NoRuKo
philnash
37
2.5k
Building Applications with DynamoDB
mza
88
5.6k
Atom: Resistance is Futile
akmur
259
25k
Typedesign – Prime Four
hannesfritz
36
2.1k
Designing Dashboards & Data Visualisations in Web Apps
destraynor
226
51k
Building a Modern Day E-commerce SEO Strategy
aleyda
17
6.4k
The Art of Programming - Codeland 2020
erikaheidi
42
12k
Keith and Marios Guide to Fast Websites
keithpitt
408
22k
The Invisible Side of Design
smashingmag
294
49k
Optimizing for Happiness
mojombo
370
69k
jQuery: Nuts, Bolts and Bling
dougneiner
59
7.1k
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