Top Banner
Managing CSS for a BIG ASS WEBSITE – at Netlog – Lennart Schoors
21

Managing CSS for a big ass website - at Netlog

Jan 18, 2015

Download

Technology

Lennart Schoors

presented at Barcamp Antwerp 4, September 11, 2010
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Managing CSS for a big ass website - at Netlog

Managing CSS for a

BIG ASSWEBSITE

– at Netlog –

Lennart Schoors

Page 2: Managing CSS for a big ass website - at Netlog

Me

.web designer at Netloghttp://www.netlog.com

. blog at http://lensco.be

Page 3: Managing CSS for a big ass website - at Netlog

Netlog

Page 4: Managing CSS for a big ass website - at Netlog

.100.000.000 visitors/month

.3.000.000.000 pageviews/month

.more than 1.500 templates

. lots of traffic & lots of different pages

.3 designers (vs. ~15 developers)

How big is big ass?

Page 5: Managing CSS for a big ass website - at Netlog

Environment

.minified

.concatenated

.about 40 CSS files

.3-4 files/page max

. served from CDN

Staging

. full, commented

. seperate files

.about 60 CSS files

. in SVN

Live

Page 6: Managing CSS for a big ass website - at Netlog

Framework

Page 7: Managing CSS for a big ass website - at Netlog

netlog.css

. the engine

.about 150kb

.used sitewide on nearly every page

Page 8: Managing CSS for a big ass website - at Netlog

netlog.css consists of (1/3)

.netlog.core.css

.css reset, typography (all of it), basic elements & headings, common classes like left, right, clearfix, clear, lists, …

.netlog.common.css

. "grid", boxes, building blocks & widgets, navigation, tabs, status messages, dialogs

Page 9: Managing CSS for a big ass website - at Netlog

netlog.css consists of (2/3)

.netlog.icons.css & netlog.ui.css

. images sprites

.use text clippings to expand “icon” to

<img src="{top.__static}/s/i/common/blank.gif" class="icon icon " alt="" />

Page 10: Managing CSS for a big ass website - at Netlog
Page 11: Managing CSS for a big ass website - at Netlog

.hover & selected states for icon sprites

bonus tip

<img src="{top.__static}/s/i/common/blank.gif" class="icon iconDelete iconOn" alt="" /><img src="{top.__static}/s/i/common/blank.gif" class="icon iconDeleteAlt iconOff" alt="" />

Page 12: Managing CSS for a big ass website - at Netlog

netlog.css consists of (3/3)

.netlog.wrapper.css

.header & footer styles

.netlog.forms.css

.buttons & inputs, form layouts, …

.netlog.ads.css

Page 13: Managing CSS for a big ass website - at Netlog

Other files

. seperate file per “vertical”

. seperate files for certain features

. IE6 & IE7 styles via conditional comments

.Right-to-left styles for RTL languages

.mobile

.external widgets

Page 14: Managing CSS for a big ass website - at Netlog

Our code

. lots of comments

.headings & subheadings

. indentation

Page 15: Managing CSS for a big ass website - at Netlog
Page 16: Managing CSS for a big ass website - at Netlog

.emphasis on classes & combing them

<a href="/foo" class="button buttonSmall buttonRed buttonCapitals inline">bar</a>

. shift the load from always downloaded CSS to take-what-you-need HTML

. “new pages don't need new css”

Page 17: Managing CSS for a big ass website - at Netlog

“OOCSS”... but CSS is not programming ;-)

Some call it ...

Page 18: Managing CSS for a big ass website - at Netlog

Deploying

Page 19: Managing CSS for a big ass website - at Netlog

Deploy script

.check diff

.combines & minifies specified files

. rsync to our servers

. sync to CDN

Page 20: Managing CSS for a big ass website - at Netlog

Dealing with cache

.deploy bumps version number in config

http: //v.netlogstatic.com/v6.00/3077/s/c/netlog.css

.now global, soon per file

Page 21: Managing CSS for a big ass website - at Netlog

That’s all folks!

Read on at http://lensco.be

Questions?