SlideShare a Scribd company logo
berlin amsterdam san francisco stuttgart
edenspiekermann_
Lessons from the FontShop
site relaunch
UpFront talk
8th July 2014
edenspiekermann_
CSS ARCHITECTURE
Lessons from the FontShop site relaunch 08.07.2014edenspiekermann_
body {!
font-size: 100%;!
font-family: Georgia, serif;!
}!
!
.o-chosen-select-box.chosen-
container,.m-font-
autocomplete{display:inline-
block;position:relative;vertical-
align:middle}.o-chosen-select-
box .chosen-single,.m-font-
autocomplete__input{background-
color:#f9f8f3;color:#262626;-webkit-box-
sizing:border-box;-moz-box-sizing:border-box;box-
sizing:border-box;border:4px solid
#fff;display:block;cursor:pointer;height:2.5em;line-
height:1.25em;padding:0 2.125em;-webkit-transition:background-
color 150ms,border-color 150ms;-moz-transition:background-color
150ms,border-color 150ms;!
.l-modal__tooltip__pane{z-index:30}.o-error{z-index:10}.o-
pulldown-panel__list{z-index:10}.l-tryout-page__canvas{z-index:
1}.l-tryout-page__header{z-index:30}.m-tryout-
textblock__action{z-index:20}.m-tryout-
textblock__editable{z-index:20}.m-tryout-
textblock__placeholder{z-index:10}.m-font-
autocomplete__dropdown,.o-chosen-select-
box{z-index:40}.l-tryout-page__template-
links,.l-tryout-page__bgimage-info{z-
index:50}.l-tryout-page__meta-links{z-
index:10000}.m-tryout-template-links
—centered{z-index:10}!
!
#footer .left-column .article
ul.links > li a img {!
border-color: #0A0;!
}!
CSS Architecture
Scientifically proven fact: a developer’s attention span
gets diluted after 34.23 continuous lines of CSS code.*
3
* = Bullshit Researching Institute GmbH, 1999
Lessons from the FontShop site relaunch 08.07.2014edenspiekermann_
CSS Architecture
4
Lessons from the FontShop site relaunch 08.07.2014edenspiekermann_
CSS Architecture
5
Lessons from the FontShop site relaunch 08.07.2014edenspiekermann_
_config/!
! extends/!
! mixins/!
! ! _colors.sass!
! ! …!
! var/!
! ! _animations.sass!
! ! …!
! _z-index.sass!
!
globals/!
! _typography.sass!
! …!
!
objects/!
! _o-button.sass!
! …!
!
modules/!
! _m-waterfalls.sass!
! …!
!
layouts/!
! _l-homepage.sass!
! …!
!
vendor/!
! _noone.reads.me.lol.sass!
! …!
!
application.sass
CSS Architecture
Structure.
– Vars, mixins under _config ensure consistency.
– Globals folder contains non-modular global styles.
– Objects folder has the smallest modular units.
– Modules are combined Objects. Sometimes not exactly
modular but mapped to content entities.
– Layouts contain only layout (duh) information such as
width, height, margin, padding.
6
edenspiekermann_
Douchebag score
Referencing yourself
in your presentation.
+1
Lessons from the FontShop site relaunch 08.07.2014edenspiekermann_
CSS Architecture
8
Lessons from the FontShop site relaunch 08.07.2014edenspiekermann_
CSS Architecture
9
.m-styles__families__slider__family__rail__node
Lessons from the FontShop site relaunch 08.07.2014edenspiekermann_
CSS Architecture
Good things:
– Self explanatory in both HTML & CSS.
– Shields object’s scope.
!
Bad things:
– Can easily get carried away with underlines.
– Verbal classes (but you get used to it).
!
Things to remember:
– Never nest selectors (to ensure specificity == 1).
– Always & only, use classes.
10
Lessons from the FontShop site relaunch 08.07.2014edenspiekermann_
CSS Architecture
11
117CSS Objects in the project
Lessons from the FontShop site relaunch 08.07.2014edenspiekermann_
CSS Architecture
12
edenspiekermann_
The
form - functionality
paradox
https://www.flickr.com/photos/astrid/2583356797
Lessons from the FontShop site relaunch 08.07.2014edenspiekermann_
CSS Architecture
14
1
Lessons from the FontShop site relaunch 08.07.2014edenspiekermann_
CSS Architecture
15
2
Lessons from the FontShop site relaunch 08.07.2014edenspiekermann_
CSS Architecture
16
3
Lessons from the FontShop site relaunch 08.07.2014edenspiekermann_
CSS Architecture
17
Same Functionality ≠ Modularity
–Elements that serve the same functionality don’t have
to be the same CSS objects.
–Otherwise it’s a game of show, hide, absolute position
elements.
–More info: http://www.edenspiekermann.com/blog/
oocss-and-the-pagification-of-modules
1 2
3
Douchebag score
Sorry, did it again!+1
edenspiekermann_
Living Styleguides
Hardboiled Front End Development 10.06.2014edenspiekermann_
CSS Architecture
Requirements-Challenges:
–Auto-maintained. No duplicate views in production &
styleguide.
–CSS Refactoring at the same time, to normalise objects.
!
Advantages:
–Nice overview of all your objects.
–Enforces good practices.
–Enhances developer — designer collaboration.
–Helps you scale your project.
!
Tool:
–https://github.com/kneath/kss
19
Hardboiled Front End Development 10.06.2014edenspiekermann_
gem install kss
CSS Architecture
Setting up KSS.
– Install gem.
20
Hardboiled Front End Development 10.06.2014edenspiekermann_
@styleguides = Kss::Parser.new(“/
public/css“)!
CSS Architecture
Setting up KSS.
– Install gem.
– Parse CSS folder into an object.
21
Hardboiled Front End Development 10.06.2014edenspiekermann_
CSS Architecture
Setting up KSS.
– Install gem.
– Parse CSS folder into an object.
– Iterate object in view.
22
- @styleguides.each do |styleguide|!
- [...]!
Hardboiled Front End Development 10.06.2014edenspiekermann_
/*!
The global button object.!
!
.button - Primary button.!
.button--green - Green variation.!
!
Styleguide 1.0 Button!
*/!
!
.button {!
height: 20px;!
text-align: center;!
width: 100px;!
}!
!
.button--green {!
background-color: green;!
}!
CSS Architecture
Setting up KSS.
– Install gem.
– Parse CSS folder into an object.
– Iterate object in view.
– Use the magic KSS syntax.
23
edenspiekermann_
http://next.fontshop.com/styleguide/objects
edenspiekermann_
Sass
Lessons from the FontShop site relaunch 08.07.2014edenspiekermann_
CSS Architecture
26
Lessons from the FontShop site relaunch 08.07.2014edenspiekermann_ 27
Lessons from the FontShop site relaunch 08.07.2014edenspiekermann_ 28
Lessons from the FontShop site relaunch 08.07.2014edenspiekermann_
.o-logo__block--left!
+fs-color(secondary, background-color)!
CSS Architecture
Using Sass to create themes:
– Too much labor to create theme variations for each
selector.
– Created Sass function to do that automatically.
!
Problems:
– Specificity issues in overriding styles (trying to
convince myself that using “!important” is ok).
– Slow compilation times.
29
body.theme--white .o-logo__block--left {!
background-color: yellow;!
}!
body.theme--yellow .o-logo__block--left {!
background-color: white;!
}!
body.theme--black .o-logo__block--left{!
background-color: yellow;!
}!
Lessons from the FontShop site relaunch 08.07.2014edenspiekermann_
CSS Architecture
30
Lessons from the FontShop site relaunch 08.07.2014edenspiekermann_
CSS Architecture
31
~12secCSS loading time during development
Lessons from the FontShop site relaunch 08.07.2014edenspiekermann_
CSS Architecture
32
~12secCSS loading time during development
On a frickin’ 2.8Ghz, 16GB Ram, SSD Machine.
Lessons from the FontShop site relaunch 08.07.2014edenspiekermann_
CSS Architecture
Tips:
– Helpful to prefix classes (“o-“, “l-“, “m-“), that way you recognize their
type in markup.
– Prefix JS hooks with “js-“. That way HTML/CSS restructuring doesn’t
affect javascript functionality.
– Put all rushed code in shame.css. Always write reason of inclusion in
comments.
– Keep all z-index values in z-index.css and always use increments of 10 or
more.
33
edenspiekermann_
JAVASCRIPT
Lessons from the FontShop site relaunch 08.07.2014edenspiekermann_
Javascript Modules
35
Lessons from the FontShop site relaunch 08.07.2014edenspiekermann_
Javascript Modules
36
AMD FTW!
Lessons from the FontShop site relaunch 08.07.2014edenspiekermann_
Javascript Modules
37
AMD FTW!Module Structure
Lessons from the FontShop site relaunch 08.07.2014edenspiekermann_
Javascript Modules
38
AMD FTW!Module Structure r.js wrapper -> .min.js
Lessons from the FontShop site relaunch 08.07.2014edenspiekermann_
Javascript Modules
39
AMD FTW!Module Structure r.js wrapper -> .min.js
Lessons from the FontShop site relaunch 08.07.2014edenspiekermann_
Javascript Modules
40
AMD FTW!Module Structure r.js wrapper -> .min.js
Lessons from the FontShop site relaunch 08.07.2014edenspiekermann_
Javascript Modules
41
AMD FTW!Module Structure r.js wrapper -> .min.js?
Lessons from the FontShop site relaunch 08.07.2014edenspiekermann_
Javascript Modules
42
AMD FTW!Module Structure r.js wrapper -> .min.js?
Lessons from the FontShop site relaunch 08.07.2014edenspiekermann_
Javascript Modules
43
AMD FTW!Module Structure r.js wrapper -> .min.js?
Lessons from the FontShop site relaunch 08.07.2014edenspiekermann_
Javascript Modules
44
AMD FTW!Module Structure r.js wrapper -> .min.js
HAHAHAHA!
Lessons from the FontShop site relaunch 08.07.2014edenspiekermann_
Javascript Modules
45
AMD FTW!Module Structure r.js wrapper -> .min.js
Lessons from the FontShop site relaunch 08.07.2014edenspiekermann_
Javascript Modules
46
Module Structure r.js wrapper -> .min.js
Lessons from the FontShop site relaunch 08.07.2014edenspiekermann_
Javascript Modules
47
Module Structure
Lessons from the FontShop site relaunch 08.07.2014edenspiekermann_
Javascript Modules
48
//= require xxx.js
//= require_tree /js/JS Modules
Tryout
Site
Buy
Lessons from the FontShop site relaunch 08.07.2014edenspiekermann_
//= require jquery!
!
(function (win) {!
!
var GlobalLikes = {};!
!
GlobalLikes = Backbone.View.extend({!
!
initialize: function () {!
this.options = _.extend({}, !
this.defaults, this.$el.data());!
this.getLikes();!
},!
! !
!
…!
…!
…!
!
! ! !
});!
!
win.fs.Modules.GlobalLikes = GlobalLikes;!
!
})(window);!
!
Javascript
Working well with Sprockets. Eventually.
– Declare dependencies with “//=require xxx”.
– Scope everything to window.fs (and pray we don’t ever
need Node’s FS module).
– Expose modules to global window.fs.Modules object.
– Using bower-rails gem for dependencies.
49
Lessons from the FontShop site relaunch 08.07.2014edenspiekermann_
Javascript
50
JS Mike = Finally Happy
Lessons from the FontShop site relaunch 08.07.2014edenspiekermann_ 51
FontShop is always looking for new dev talent!
Contact Ivo Gabrowitsch: ivo@fontshop.com.
Mention this awesome presentation.
berlin amsterdam san francisco stuttgart
edenspiekermann_
Thank you.
Spiros Martzoukos, Web Developer
tw @martzoukos
T +49 157 84340808
!
s.martzoukos@de.edenspiekermann.com
www.edenspiekermann.com

More Related Content

PDF
Jina bolton - Refactoring Web Interfaces
PDF
Olive leaf mulching
PDF
Longobardi proroga770
PDF
Diario Resumen 20160809
PDF
Informe de seguimiento plan pago proveedores 3 trimestre 2014
DOC
Sergei Kritsky RESUME
PDF
PPTX
Ever Team Taller Fesabid 09
Jina bolton - Refactoring Web Interfaces
Olive leaf mulching
Longobardi proroga770
Diario Resumen 20160809
Informe de seguimiento plan pago proveedores 3 trimestre 2014
Sergei Kritsky RESUME
Ever Team Taller Fesabid 09

Viewers also liked (18)

PPTX
Innovation for Businesses
PDF
FEM Magazine 2013
PDF
Mastering Positive Change
DOCX
Laura lopez burning season
PPTX
C.P.C Abog Carlos Zambrano Aranda. Gerente de Soluciones Legales & Contables ...
PPTX
Social mediaoverviewupdated
PDF
Presentacion tecnochip
PDF
3 present inv_publica
PPT
Presentación de la Cátedra Externa del Dolor de la Fundación Grunenthal y la UCA
PDF
Water Solutions for Harbors
PPTX
Matanza en san pedro de la cueva
PDF
Talk given at Internet of Things Helsinki Meetup held at the premise of Zalando
PPT
Inflammatory arthritis; a quick run through.
PDF
Salesforce.com Relaunch Featuring Customer Success Story From Aon
PDF
Super x launch proposal
PPT
Holiday Inn Eindhoven relaunch
PDF
Polaroid Proyect. Relaunch Brand
PPTX
Certified entrepreneurial community program relaunch
Innovation for Businesses
FEM Magazine 2013
Mastering Positive Change
Laura lopez burning season
C.P.C Abog Carlos Zambrano Aranda. Gerente de Soluciones Legales & Contables ...
Social mediaoverviewupdated
Presentacion tecnochip
3 present inv_publica
Presentación de la Cátedra Externa del Dolor de la Fundación Grunenthal y la UCA
Water Solutions for Harbors
Matanza en san pedro de la cueva
Talk given at Internet of Things Helsinki Meetup held at the premise of Zalando
Inflammatory arthritis; a quick run through.
Salesforce.com Relaunch Featuring Customer Success Story From Aon
Super x launch proposal
Holiday Inn Eindhoven relaunch
Polaroid Proyect. Relaunch Brand
Certified entrepreneurial community program relaunch
Ad

Similar to Lessons learnt from the FontShop site relaunch (20)

PPTX
Grokking TechTalk #16: F**k bad CSS
KEY
HTML CSS & Javascript
PDF
CSS3: Ripe and Ready
PDF
WV TRAIL Stylesheet
PDF
Hardboiled Front End Development — Found.ation
PDF
Intro to CSS3
PDF
CSS3 - is everything we used to do wrong?
PDF
Creating a CSS and JS design system from the ground up
PDF
X-TREME THEMES
PDF
CSS3: Ripe and Ready to Respond
PDF
A complete html and css guidelines for beginners
PDF
Simply Responsive CSS3
PDF
Creating Style Guides with Modularity in Mind
KEY
The Fast And The Fabulous
PDF
CSS The Definitive Guide Visual Presentation for the Web 4th Edition Eric A. ...
PPTX
Beautiful Web Design
KEY
CSS3: stay tuned for style
PDF
InTouch Logo and Branding
PPTX
UI Principles Behind Design Thinking
PDF
Useful Tools and Resources for Web Designers
Grokking TechTalk #16: F**k bad CSS
HTML CSS & Javascript
CSS3: Ripe and Ready
WV TRAIL Stylesheet
Hardboiled Front End Development — Found.ation
Intro to CSS3
CSS3 - is everything we used to do wrong?
Creating a CSS and JS design system from the ground up
X-TREME THEMES
CSS3: Ripe and Ready to Respond
A complete html and css guidelines for beginners
Simply Responsive CSS3
Creating Style Guides with Modularity in Mind
The Fast And The Fabulous
CSS The Definitive Guide Visual Presentation for the Web 4th Edition Eric A. ...
Beautiful Web Design
CSS3: stay tuned for style
InTouch Logo and Branding
UI Principles Behind Design Thinking
Useful Tools and Resources for Web Designers
Ad

Recently uploaded (20)

PPTX
Geodesy 1.pptx...............................................
PPTX
CYBER-CRIMES AND SECURITY A guide to understanding
PPTX
Recipes for Real Time Voice AI WebRTC, SLMs and Open Source Software.pptx
PPT
CRASH COURSE IN ALTERNATIVE PLUMBING CLASS
PPTX
Infosys Presentation by1.Riyan Bagwan 2.Samadhan Naiknavare 3.Gaurav Shinde 4...
PPTX
UNIT-1 - COAL BASED THERMAL POWER PLANTS
PPTX
Lecture Notes Electrical Wiring System Components
PPTX
MET 305 2019 SCHEME MODULE 2 COMPLETE.pptx
PDF
Operating System & Kernel Study Guide-1 - converted.pdf
PPTX
CARTOGRAPHY AND GEOINFORMATION VISUALIZATION chapter1 NPTE (2).pptx
PDF
Automation-in-Manufacturing-Chapter-Introduction.pdf
PPTX
CH1 Production IntroductoryConcepts.pptx
PDF
Mitigating Risks through Effective Management for Enhancing Organizational Pe...
PPTX
bas. eng. economics group 4 presentation 1.pptx
PDF
The CXO Playbook 2025 – Future-Ready Strategies for C-Suite Leaders Cerebrai...
PPTX
MCN 401 KTU-2019-PPE KITS-MODULE 2.pptx
PDF
Well-logging-methods_new................
PDF
Embodied AI: Ushering in the Next Era of Intelligent Systems
PDF
Digital Logic Computer Design lecture notes
PDF
BMEC211 - INTRODUCTION TO MECHATRONICS-1.pdf
Geodesy 1.pptx...............................................
CYBER-CRIMES AND SECURITY A guide to understanding
Recipes for Real Time Voice AI WebRTC, SLMs and Open Source Software.pptx
CRASH COURSE IN ALTERNATIVE PLUMBING CLASS
Infosys Presentation by1.Riyan Bagwan 2.Samadhan Naiknavare 3.Gaurav Shinde 4...
UNIT-1 - COAL BASED THERMAL POWER PLANTS
Lecture Notes Electrical Wiring System Components
MET 305 2019 SCHEME MODULE 2 COMPLETE.pptx
Operating System & Kernel Study Guide-1 - converted.pdf
CARTOGRAPHY AND GEOINFORMATION VISUALIZATION chapter1 NPTE (2).pptx
Automation-in-Manufacturing-Chapter-Introduction.pdf
CH1 Production IntroductoryConcepts.pptx
Mitigating Risks through Effective Management for Enhancing Organizational Pe...
bas. eng. economics group 4 presentation 1.pptx
The CXO Playbook 2025 – Future-Ready Strategies for C-Suite Leaders Cerebrai...
MCN 401 KTU-2019-PPE KITS-MODULE 2.pptx
Well-logging-methods_new................
Embodied AI: Ushering in the Next Era of Intelligent Systems
Digital Logic Computer Design lecture notes
BMEC211 - INTRODUCTION TO MECHATRONICS-1.pdf

Lessons learnt from the FontShop site relaunch

  • 1. berlin amsterdam san francisco stuttgart edenspiekermann_ Lessons from the FontShop site relaunch UpFront talk 8th July 2014
  • 3. Lessons from the FontShop site relaunch 08.07.2014edenspiekermann_ body {! font-size: 100%;! font-family: Georgia, serif;! }! ! .o-chosen-select-box.chosen- container,.m-font- autocomplete{display:inline- block;position:relative;vertical- align:middle}.o-chosen-select- box .chosen-single,.m-font- autocomplete__input{background- color:#f9f8f3;color:#262626;-webkit-box- sizing:border-box;-moz-box-sizing:border-box;box- sizing:border-box;border:4px solid #fff;display:block;cursor:pointer;height:2.5em;line- height:1.25em;padding:0 2.125em;-webkit-transition:background- color 150ms,border-color 150ms;-moz-transition:background-color 150ms,border-color 150ms;! .l-modal__tooltip__pane{z-index:30}.o-error{z-index:10}.o- pulldown-panel__list{z-index:10}.l-tryout-page__canvas{z-index: 1}.l-tryout-page__header{z-index:30}.m-tryout- textblock__action{z-index:20}.m-tryout- textblock__editable{z-index:20}.m-tryout- textblock__placeholder{z-index:10}.m-font- autocomplete__dropdown,.o-chosen-select- box{z-index:40}.l-tryout-page__template- links,.l-tryout-page__bgimage-info{z- index:50}.l-tryout-page__meta-links{z- index:10000}.m-tryout-template-links —centered{z-index:10}! ! #footer .left-column .article ul.links > li a img {! border-color: #0A0;! }! CSS Architecture Scientifically proven fact: a developer’s attention span gets diluted after 34.23 continuous lines of CSS code.* 3 * = Bullshit Researching Institute GmbH, 1999
  • 4. Lessons from the FontShop site relaunch 08.07.2014edenspiekermann_ CSS Architecture 4
  • 5. Lessons from the FontShop site relaunch 08.07.2014edenspiekermann_ CSS Architecture 5
  • 6. Lessons from the FontShop site relaunch 08.07.2014edenspiekermann_ _config/! ! extends/! ! mixins/! ! ! _colors.sass! ! ! …! ! var/! ! ! _animations.sass! ! ! …! ! _z-index.sass! ! globals/! ! _typography.sass! ! …! ! objects/! ! _o-button.sass! ! …! ! modules/! ! _m-waterfalls.sass! ! …! ! layouts/! ! _l-homepage.sass! ! …! ! vendor/! ! _noone.reads.me.lol.sass! ! …! ! application.sass CSS Architecture Structure. – Vars, mixins under _config ensure consistency. – Globals folder contains non-modular global styles. – Objects folder has the smallest modular units. – Modules are combined Objects. Sometimes not exactly modular but mapped to content entities. – Layouts contain only layout (duh) information such as width, height, margin, padding. 6
  • 8. Lessons from the FontShop site relaunch 08.07.2014edenspiekermann_ CSS Architecture 8
  • 9. Lessons from the FontShop site relaunch 08.07.2014edenspiekermann_ CSS Architecture 9 .m-styles__families__slider__family__rail__node
  • 10. Lessons from the FontShop site relaunch 08.07.2014edenspiekermann_ CSS Architecture Good things: – Self explanatory in both HTML & CSS. – Shields object’s scope. ! Bad things: – Can easily get carried away with underlines. – Verbal classes (but you get used to it). ! Things to remember: – Never nest selectors (to ensure specificity == 1). – Always & only, use classes. 10
  • 11. Lessons from the FontShop site relaunch 08.07.2014edenspiekermann_ CSS Architecture 11 117CSS Objects in the project
  • 12. Lessons from the FontShop site relaunch 08.07.2014edenspiekermann_ CSS Architecture 12
  • 14. Lessons from the FontShop site relaunch 08.07.2014edenspiekermann_ CSS Architecture 14 1
  • 15. Lessons from the FontShop site relaunch 08.07.2014edenspiekermann_ CSS Architecture 15 2
  • 16. Lessons from the FontShop site relaunch 08.07.2014edenspiekermann_ CSS Architecture 16 3
  • 17. Lessons from the FontShop site relaunch 08.07.2014edenspiekermann_ CSS Architecture 17 Same Functionality ≠ Modularity –Elements that serve the same functionality don’t have to be the same CSS objects. –Otherwise it’s a game of show, hide, absolute position elements. –More info: http://www.edenspiekermann.com/blog/ oocss-and-the-pagification-of-modules 1 2 3 Douchebag score Sorry, did it again!+1
  • 19. Hardboiled Front End Development 10.06.2014edenspiekermann_ CSS Architecture Requirements-Challenges: –Auto-maintained. No duplicate views in production & styleguide. –CSS Refactoring at the same time, to normalise objects. ! Advantages: –Nice overview of all your objects. –Enforces good practices. –Enhances developer — designer collaboration. –Helps you scale your project. ! Tool: –https://github.com/kneath/kss 19
  • 20. Hardboiled Front End Development 10.06.2014edenspiekermann_ gem install kss CSS Architecture Setting up KSS. – Install gem. 20
  • 21. Hardboiled Front End Development 10.06.2014edenspiekermann_ @styleguides = Kss::Parser.new(“/ public/css“)! CSS Architecture Setting up KSS. – Install gem. – Parse CSS folder into an object. 21
  • 22. Hardboiled Front End Development 10.06.2014edenspiekermann_ CSS Architecture Setting up KSS. – Install gem. – Parse CSS folder into an object. – Iterate object in view. 22 - @styleguides.each do |styleguide|! - [...]!
  • 23. Hardboiled Front End Development 10.06.2014edenspiekermann_ /*! The global button object.! ! .button - Primary button.! .button--green - Green variation.! ! Styleguide 1.0 Button! */! ! .button {! height: 20px;! text-align: center;! width: 100px;! }! ! .button--green {! background-color: green;! }! CSS Architecture Setting up KSS. – Install gem. – Parse CSS folder into an object. – Iterate object in view. – Use the magic KSS syntax. 23
  • 26. Lessons from the FontShop site relaunch 08.07.2014edenspiekermann_ CSS Architecture 26
  • 27. Lessons from the FontShop site relaunch 08.07.2014edenspiekermann_ 27
  • 28. Lessons from the FontShop site relaunch 08.07.2014edenspiekermann_ 28
  • 29. Lessons from the FontShop site relaunch 08.07.2014edenspiekermann_ .o-logo__block--left! +fs-color(secondary, background-color)! CSS Architecture Using Sass to create themes: – Too much labor to create theme variations for each selector. – Created Sass function to do that automatically. ! Problems: – Specificity issues in overriding styles (trying to convince myself that using “!important” is ok). – Slow compilation times. 29 body.theme--white .o-logo__block--left {! background-color: yellow;! }! body.theme--yellow .o-logo__block--left {! background-color: white;! }! body.theme--black .o-logo__block--left{! background-color: yellow;! }!
  • 30. Lessons from the FontShop site relaunch 08.07.2014edenspiekermann_ CSS Architecture 30
  • 31. Lessons from the FontShop site relaunch 08.07.2014edenspiekermann_ CSS Architecture 31 ~12secCSS loading time during development
  • 32. Lessons from the FontShop site relaunch 08.07.2014edenspiekermann_ CSS Architecture 32 ~12secCSS loading time during development On a frickin’ 2.8Ghz, 16GB Ram, SSD Machine.
  • 33. Lessons from the FontShop site relaunch 08.07.2014edenspiekermann_ CSS Architecture Tips: – Helpful to prefix classes (“o-“, “l-“, “m-“), that way you recognize their type in markup. – Prefix JS hooks with “js-“. That way HTML/CSS restructuring doesn’t affect javascript functionality. – Put all rushed code in shame.css. Always write reason of inclusion in comments. – Keep all z-index values in z-index.css and always use increments of 10 or more. 33
  • 35. Lessons from the FontShop site relaunch 08.07.2014edenspiekermann_ Javascript Modules 35
  • 36. Lessons from the FontShop site relaunch 08.07.2014edenspiekermann_ Javascript Modules 36 AMD FTW!
  • 37. Lessons from the FontShop site relaunch 08.07.2014edenspiekermann_ Javascript Modules 37 AMD FTW!Module Structure
  • 38. Lessons from the FontShop site relaunch 08.07.2014edenspiekermann_ Javascript Modules 38 AMD FTW!Module Structure r.js wrapper -> .min.js
  • 39. Lessons from the FontShop site relaunch 08.07.2014edenspiekermann_ Javascript Modules 39 AMD FTW!Module Structure r.js wrapper -> .min.js
  • 40. Lessons from the FontShop site relaunch 08.07.2014edenspiekermann_ Javascript Modules 40 AMD FTW!Module Structure r.js wrapper -> .min.js
  • 41. Lessons from the FontShop site relaunch 08.07.2014edenspiekermann_ Javascript Modules 41 AMD FTW!Module Structure r.js wrapper -> .min.js?
  • 42. Lessons from the FontShop site relaunch 08.07.2014edenspiekermann_ Javascript Modules 42 AMD FTW!Module Structure r.js wrapper -> .min.js?
  • 43. Lessons from the FontShop site relaunch 08.07.2014edenspiekermann_ Javascript Modules 43 AMD FTW!Module Structure r.js wrapper -> .min.js?
  • 44. Lessons from the FontShop site relaunch 08.07.2014edenspiekermann_ Javascript Modules 44 AMD FTW!Module Structure r.js wrapper -> .min.js HAHAHAHA!
  • 45. Lessons from the FontShop site relaunch 08.07.2014edenspiekermann_ Javascript Modules 45 AMD FTW!Module Structure r.js wrapper -> .min.js
  • 46. Lessons from the FontShop site relaunch 08.07.2014edenspiekermann_ Javascript Modules 46 Module Structure r.js wrapper -> .min.js
  • 47. Lessons from the FontShop site relaunch 08.07.2014edenspiekermann_ Javascript Modules 47 Module Structure
  • 48. Lessons from the FontShop site relaunch 08.07.2014edenspiekermann_ Javascript Modules 48 //= require xxx.js //= require_tree /js/JS Modules Tryout Site Buy
  • 49. Lessons from the FontShop site relaunch 08.07.2014edenspiekermann_ //= require jquery! ! (function (win) {! ! var GlobalLikes = {};! ! GlobalLikes = Backbone.View.extend({! ! initialize: function () {! this.options = _.extend({}, ! this.defaults, this.$el.data());! this.getLikes();! },! ! ! ! …! …! …! ! ! ! ! });! ! win.fs.Modules.GlobalLikes = GlobalLikes;! ! })(window);! ! Javascript Working well with Sprockets. Eventually. – Declare dependencies with “//=require xxx”. – Scope everything to window.fs (and pray we don’t ever need Node’s FS module). – Expose modules to global window.fs.Modules object. – Using bower-rails gem for dependencies. 49
  • 50. Lessons from the FontShop site relaunch 08.07.2014edenspiekermann_ Javascript 50 JS Mike = Finally Happy
  • 51. Lessons from the FontShop site relaunch 08.07.2014edenspiekermann_ 51 FontShop is always looking for new dev talent! Contact Ivo Gabrowitsch: ivo@fontshop.com. Mention this awesome presentation.
  • 52. berlin amsterdam san francisco stuttgart edenspiekermann_ Thank you. Spiros Martzoukos, Web Developer tw @martzoukos T +49 157 84340808 ! s.martzoukos@de.edenspiekermann.com www.edenspiekermann.com