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
58
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
31
2.7k
Trust & Teams: 2019 Chicago CTO Summit
rmw
2
250
Refactoring Trust on Your Team (CTO Summit 2018)
rmw
1
1.2k
Trust and Teams: GORUCO 2017
rmw
0
200
Becoming an Engineer Leader Panel Intro Slide
rmw
0
240
Frameworks for Feedback (Long version) - 2016 May Self Conference
rmw
2
820
Frameworks for Feedback (2015 May - RailsConf)
rmw
1
450
Frameworks for Feedback - DevOpsDays Chicago
rmw
0
860
Tech Talk 101: Topic Generation
rmw
0
330
Other Decks in Programming
See All in Programming
みんなでプロポーザルを書いてみた
yuriko1211
0
260
AWS IaCの注目アップデート 2024年10月版
konokenj
3
3.3k
A Journey of Contribution and Collaboration in Open Source
ivargrimstad
0
880
Nurturing OpenJDK distribution: Eclipse Temurin Success History and plan
ivargrimstad
0
870
NSOutlineView何もわからん:( 前編 / I Don't Understand About NSOutlineView :( Pt. 1
usagimaru
0
330
弊社の「意識チョット低いアーキテクチャ」10選
texmeijin
5
24k
イベント駆動で成長して委員会
happymana
1
320
Jakarta EE meets AI
ivargrimstad
0
520
【Kaigi on Rails 2024】YOUTRUST スポンサーLT
krpk1900
1
330
as(型アサーション)を書く前にできること
marokanatani
9
2.6k
色々なIaCツールを実際に触って比較してみる
iriikeita
0
330
Pinia Colada が実現するスマートな非同期処理
naokihaba
4
220
Featured
See All Featured
Intergalactic Javascript Robots from Outer Space
tanoku
269
27k
Distributed Sagas: A Protocol for Coordinating Microservices
caitiem20
329
21k
Testing 201, or: Great Expectations
jmmastey
38
7.1k
Unsuck your backbone
ammeep
668
57k
What's in a price? How to price your products and services
michaelherold
243
12k
XXLCSS - How to scale CSS and keep your sanity
sugarenia
246
1.3M
Let's Do A Bunch of Simple Stuff to Make Websites Faster
chriscoyier
506
140k
Easily Structure & Communicate Ideas using Wireframe
afnizarnur
191
16k
RailsConf & Balkan Ruby 2019: The Past, Present, and Future of Rails at GitHub
eileencodes
131
33k
Responsive Adventures: Dirty Tricks From The Dark Corners of Front-End
smashingmag
250
21k
The Art of Delivering Value - GDevCon NA Keynote
reverentgeek
8
860
Building a Scalable Design System with Sketch
lauravandoore
459
33k
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