SlideShare a Scribd company logo
1 of 46
Download to read offline
berlin amsterdam san francisco stuttgart
edenspiekermann_
Hardboiled Front End
Development
Found.ation talk
10th June 2014
Hardboiled Front End Development 10.06.2014edenspiekermann_
Introduction
Web Developer at Edenspiekermann.
!
Previously:
– Head of Design @ DailySecret.com.
– Head of Front End @ Liberis Publications.
!
Enjoys:
– CSS architecture.
– Refactoring code.
2
Hardboiled Front End Development 10.06.2014edenspiekermann_
Contents
1. CSS Architecture
–OOCSS. Design modules, not pages.
–BEM. Protecting scope. Hacking CSS.
–Sass. Enabling modularity. Pitfalls of extending and using mixins.
–Living Styleguides. Keeping the mess observable.
–Best Practices. Class prefixes, shame.css, z-index.css.
!
2. Javascript Modularity
–Modularity. Breaking the $(document).ready long file into modules.
–Module Tools. Including functionality on demand with requireJS.
–Automating tasks. Automating with Grunt and managing packages with Bower.
–Frameworks. Angular, Backbone, a very quick overview.
–Little useful tools. Backbone.wreqr, waypoints, owl carousel.
3
edenspiekermann_
CSS ARCHITECTURE
Hardboiled Front End Development 10.06.2014edenspiekermann_
CSS Architecture
CSS Advantages:
– Fast, quick to put something out.
– Small learning curve.
– Easy to override defaults.
!
Problems with CSS:
– All the above :-).
– No inherent modularity.
– No scope.
– Specificity.
5
edenspiekermann_
Think Modular
7
8
9
10
edenspiekermann_
Tools for modularity:
– SMACSS
– OOCSS
edenspiekermann_
Hardboiled Front End Development 10.06.2014edenspiekermann_
CSS Architecture
!
– Decouple Structure from Skin.
– Modifier classes.
– File structuring flexibility.
– Tackle Specificity issue (completely).
14
SMACSS
✓
✓
×
×
OOCSS
✓
×
✓
×
edenspiekermann_
What about specificity?
edenspiekermann_
http://designshack.net/articles/css/what-the-heck-is-css-specificity/
edenspiekermann_
http://www.stuffandnonsense.co.uk/archives/css_specificity_wars.html
edenspiekermann_
http://cssspecificity.com/
Hardboiled Front End Development 10.06.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: we can’t keep track of
specificity throughout a CSS document.
19
Hardboiled Front End Development 10.06.2014edenspiekermann_
.o-square {!
height: 100px;!
width: 100px;!
}!
!
.o-square--black {!
background-color: black;!
}!
!
.o-square--green {!
background-color: green;!
}!
!
.o-square__inner-circle {!
border-radius: 100%;!
}!
!
.o-square__inner-circle--blue {!
background-color: blue;!
}!
CSS Architecture
Enter BEM.
– BEM stands for Block Element Modifier.
– Works like this: .block _ _ element - - modifier
– Self explanatory in both HTML & CSS.
– Shields object’s scope.
!
Things to remember:
– Never nest selectors (to ensure specificity == 1).
– Always & only, use classes.
– One object per file.
20
edenspiekermann_
Living Styleguides
Hardboiled Front End Development 10.06.2014edenspiekermann_
CSS Architecture
Advantages:
– Nice overview of all your objects.
– Enforces good practices.
– Enhances developer — designer collaboration.
– Helpful for context free development.
!
Challenges:
– Hard to initially set up.
– If not set up correctly, can have dulicate views in production & styleguide.
– Same object, different data issues.
!
Tools:
– https://github.com/kneath/kss
– http://livingstyleguide.org
– http://kaleistyleguide.com/
22
Hardboiled Front End Development 10.06.2014edenspiekermann_
gem install kss
CSS Architecture
Setting up KSS.
– Install gem.
23
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.
24
Hardboiled Front End Development 10.06.2014edenspiekermann_
CSS Architecture
Setting up KSS.
– Install gem.
– Parse CSS folder into an object.
– Iterate object in view.
25
- @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.
26
edenspiekermann_
Automating with Sass.
Hardboiled Front End Development 10.06.2014edenspiekermann_
CSS Architecture
Sass enables:
– Modular file structure with @import globbing.
– Eliminating inconsistencies. Vars for colours, typographic rythm units,
breakpoints, animation durations.
!
Pitfalls:
– “Mixins” print content inside of rule. Duplicate content.
– “Extends” group selectors where used. Rules are moved out of intended
place, watch out for split CSS files.
– Slow compiling of too many files, in Rails. Use libsass.
28
edenspiekermann_
Tips and Tricks.
Hardboiled Front End Development 10.06.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.
– Use “is-” for dynamic states, induced by JS. For different kinds of states,
use BEM modifiers.
– 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.
30
edenspiekermann_
Ddddddemo
CSS Architecture
next.fontshop.com
edenspiekermann_
JS MODULARITY
Hardboiled Front End Development 10.06.2014edenspiekermann_
$(document).ready(function() {!
!
$(window).on('resize', resizeHandler);!
app.windowWidth = $window.width();!
app.windowHeight = $window.height();!
!
$(window).on("resizestart", function(){!
app.vent.trigger('fs:resize-start',
app.windowWidth, app.windowHeight);!
}).on("resizestop", function(){!
app.vent.trigger('fs:resize-stop',
app.windowWidth, app.windowHeight);!
});!
!
//Scrolling event, debounced at 500ms!
$(window).on("scroll", function(){!
var scrollFunc = _.debounce(function()
{!
app.vent.trigger('fs:scroll', $
(this).scrollTop());!
}, 500);!
scrollFunc();!
});!
!
// Show the targeted offscreen panel by
emitting the offscreen-panel:show event.!
// Creates one offscreen panel if it
doesn't exist already (as in editor or
languages list)!
$(document).on('click', ".js-show-
offscreen-panel, .js-family-finder-
trigger", function(event){!
Breaking long script files into chunks
Traditional approach: one long file
– Variable scope problems.
– Duplicate logic.
– Error prone.
– Impossible to maintain.
33
edenspiekermann_
Axiom:
Projects will ALWAYS scale.
https://www.flickr.com/photos/astrid/2583356797
Hardboiled Front End Development 10.06.2014edenspiekermann_
...!
!
<script src="jquery.js"></script>!
<script src="module1.js"></script>!
<script src="module2.js"></script>!
<script src="module3.js"></script>!
!
</body>!
</html>!
Breaking long script files into chunks
Alternative approach: Split & Include manually
– Too much manual labour.
– How do you handle common dependencies?
– Conflicts in the global object.
– Order of loading is important.
35
Hardboiled Front End Development 10.06.2014edenspiekermann_
define([
Breaking long script files into chunks
Better approach: Modularize everything
– Create a new file and define a module.
36
Hardboiled Front End Development 10.06.2014edenspiekermann_
define([!
"jquery",!
"jquery-ui"!
],!
function ($, jqueryUI) {!
Breaking long script files into chunks
Better approach: Modularize everything
– Create a new file and define a module.
– State its dependencies.
37
Hardboiled Front End Development 10.06.2014edenspiekermann_
define([!
"jquery",!
"jquery-ui"!
],!
function ($, jqueryUI) {!
!
var init = function (options) {!
//...implement logic!
};!
!
init(options);!
!
});!
Breaking long script files into chunks
Better approach: Modularize everything
– Create a new file and define a module.
– State its dependencies.
– Implement your logic.
38
Hardboiled Front End Development 10.06.2014edenspiekermann_
JS Module Creation Tools
– requireJS. http://requirejs.org
– Browserify. http://browserify.org
– Webpack. http://webpack.github.io
39
edenspiekermann_
Automating your workflow
with off-browser JS.
Hardboiled Front End Development 10.06.2014edenspiekermann_
module.exports = function(grunt) {!
!
// Load libs!
grunt.loadNpmTasks('grunt-watch');!
grunt.loadNpmTasks('grunt-jshint');!
grunt.loadNpmTasks('grunt-requirejs');!
!
// Project configuration.!
grunt.initConfig({!
pkg: '<json:package.json>',!
jshint: {!
options: {!
curly: true,!
eqnull: true,!
browser: true,!
sub: true,!
boss: true!
}!
}!
!
// Define task.!
grunt.registerTask('syntax',
['jshint:src']);};!
Automating tasks with Grunt (http://gruntjs.com)
Things you can do:
– Get immediate feedback on syntax errors.
– Live reload project.
– Minify, uglify, pack code.
– Also, use requireJS optimizer.
– libSass. Blazingly fast Sass compilation.
– Image compression.
–Control everything from one config file: gruntfile.js
!
– Alternative: Gulp (http://gulpjs.com). Lot of buzz lately.
41
Hardboiled Front End Development 10.06.2014edenspiekermann_
{!
"name": "Fontshop Relaunch",!
"version": "1",!
"dependencies": {!
"fittext": "",!
"jquery": "1.11",!
"underscore": "",!
"backbone": "",!
"backbone.wreqr": "",!
"backbone.marionette": "",!
"modernizr": "",!
"picturefill": "",!
"jquery-waypoints": "",!
"jquery-sortable": "",!
"OwlCarousel": "",!
"jasmine.async": "",!
"angular": "",!
"angular-chosen-localytics": "",!
"angular-local-storage": "",!
"ng-clip": "",!
"zeroclipboard": ""!
}!
}!
Manage Dependencies with Bower (http://bower.io)
Things you can do:
– Manage dependencies from one file.
– You can specify version of scripts.
– You can change folder (to fit your folder structuring).
!
Things you can’t do:
– Include in page automatically. Use requireJS for
that :).
42
A wee bit of JS frameworks & tools.
edenspiekermann_
Hardboiled Front End Development 10.06.2014edenspiekermann_
Backbone and Angular in Fontshop.
1. Backbone
– FS wasn’t an SPA. Used Backbone as a structuring tool for our JS modules.
– Helpful events object, this.$(“…”) selector, initializers.
– Create multiple instances easily.
– Enforces good OO practices.
!
2. Angular
– Used it in the tryout (http://next.fontshop.com/tryout) section.
– No boilerplate code.
– Provides one point of change (Model).
– Very quick to set functionality up.
44
Hardboiled Front End Development 10.06.2014edenspiekermann_
Some small favorite scripts :)
Backbone.wreqr (https://github.com/marionettejs/backbone.wreqr)
– True events based apps.
– Enable true modularity.
!
Waypoints (http://imakewebthings.com/jquery-waypoints)
– No more scrolling window, object, offset calculations.
– Also, sticky headers, easily done.
!
owlCarousel (http://www.owlgraphic.com/owlcarousel)
– Touch based (draggable).
– Responsive be default.
– Uses CSS 3D transforms, where possible.
!
45
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

What's hot

Cssbestpracticesjstyleguidejandtips 150830184202-lva1-app6892
Cssbestpracticesjstyleguidejandtips 150830184202-lva1-app6892Cssbestpracticesjstyleguidejandtips 150830184202-lva1-app6892
Cssbestpracticesjstyleguidejandtips 150830184202-lva1-app6892Deepak Sharma
 
Responsive Web Design
Responsive Web DesignResponsive Web Design
Responsive Web DesignDebra Shapiro
 
State of jQuery June 2013 - Portland
State of jQuery June 2013 - PortlandState of jQuery June 2013 - Portland
State of jQuery June 2013 - Portlanddmethvin
 
jQuery Conference Austin Sept 2013
jQuery Conference Austin Sept 2013jQuery Conference Austin Sept 2013
jQuery Conference Austin Sept 2013dmethvin
 
CSS Lessons Learned the Hard Way (Generate Conf)
CSS Lessons Learned the Hard Way (Generate Conf)CSS Lessons Learned the Hard Way (Generate Conf)
CSS Lessons Learned the Hard Way (Generate Conf)Zoe Gillenwater
 
The Need for Speed - SMX Sydney 2013
The Need for Speed - SMX Sydney 2013The Need for Speed - SMX Sydney 2013
The Need for Speed - SMX Sydney 2013Bastian Grimm
 
Improving the Responsive Web Design Process in 2016
Improving the Responsive Web Design Process in 2016Improving the Responsive Web Design Process in 2016
Improving the Responsive Web Design Process in 2016Cristina Chumillas
 
Be German About Your Frontend
Be German About Your FrontendBe German About Your Frontend
Be German About Your FrontendArush Sehgal
 
Tutorial to develop build files using ANT
Tutorial to develop build files using ANTTutorial to develop build files using ANT
Tutorial to develop build files using ANTravireddy76
 
Responsive Web Design: Clever Tips and Techniques
Responsive Web Design: Clever Tips and TechniquesResponsive Web Design: Clever Tips and Techniques
Responsive Web Design: Clever Tips and TechniquesVitaly Friedman
 
Tek 2013 - Building Web Apps from a New Angle with AngularJS
Tek 2013 - Building Web Apps from a New Angle with AngularJSTek 2013 - Building Web Apps from a New Angle with AngularJS
Tek 2013 - Building Web Apps from a New Angle with AngularJSPablo Godel
 
Responsive Web Design: Tips and Tricks
Responsive Web Design: Tips and TricksResponsive Web Design: Tips and Tricks
Responsive Web Design: Tips and TricksGautam Krishnan
 
HTTP 2.0 - Web Unleashed 2015
HTTP 2.0 - Web Unleashed 2015HTTP 2.0 - Web Unleashed 2015
HTTP 2.0 - Web Unleashed 2015dmethvin
 
Levent-Gurses' Introduction to Web Components & Polymer
Levent-Gurses' Introduction to Web Components & PolymerLevent-Gurses' Introduction to Web Components & Polymer
Levent-Gurses' Introduction to Web Components & PolymerErik Isaksen
 
Single Page JavaScript WebApps... A Gradle Story
Single Page JavaScript WebApps... A Gradle StorySingle Page JavaScript WebApps... A Gradle Story
Single Page JavaScript WebApps... A Gradle StoryKon Soulianidis
 
Grunt.js and Yeoman, Continous Integration
Grunt.js and Yeoman, Continous IntegrationGrunt.js and Yeoman, Continous Integration
Grunt.js and Yeoman, Continous IntegrationDavid Amend
 
Rapid Testing, Rapid Development
Rapid Testing, Rapid DevelopmentRapid Testing, Rapid Development
Rapid Testing, Rapid Developmentmennovanslooten
 
Let Grunt do the work, focus on the fun! [Open Web Camp 2013]
Let Grunt do the work, focus on the fun! [Open Web Camp 2013]Let Grunt do the work, focus on the fun! [Open Web Camp 2013]
Let Grunt do the work, focus on the fun! [Open Web Camp 2013]Dirk Ginader
 

What's hot (20)

Cssbestpracticesjstyleguidejandtips 150830184202-lva1-app6892
Cssbestpracticesjstyleguidejandtips 150830184202-lva1-app6892Cssbestpracticesjstyleguidejandtips 150830184202-lva1-app6892
Cssbestpracticesjstyleguidejandtips 150830184202-lva1-app6892
 
Responsive Web Design
Responsive Web DesignResponsive Web Design
Responsive Web Design
 
State of jQuery June 2013 - Portland
State of jQuery June 2013 - PortlandState of jQuery June 2013 - Portland
State of jQuery June 2013 - Portland
 
jQuery Conference Austin Sept 2013
jQuery Conference Austin Sept 2013jQuery Conference Austin Sept 2013
jQuery Conference Austin Sept 2013
 
CSS Lessons Learned the Hard Way (Generate Conf)
CSS Lessons Learned the Hard Way (Generate Conf)CSS Lessons Learned the Hard Way (Generate Conf)
CSS Lessons Learned the Hard Way (Generate Conf)
 
The Need for Speed - SMX Sydney 2013
The Need for Speed - SMX Sydney 2013The Need for Speed - SMX Sydney 2013
The Need for Speed - SMX Sydney 2013
 
stickyHeader.js
stickyHeader.jsstickyHeader.js
stickyHeader.js
 
Improving the Responsive Web Design Process in 2016
Improving the Responsive Web Design Process in 2016Improving the Responsive Web Design Process in 2016
Improving the Responsive Web Design Process in 2016
 
Be German About Your Frontend
Be German About Your FrontendBe German About Your Frontend
Be German About Your Frontend
 
Tutorial to develop build files using ANT
Tutorial to develop build files using ANTTutorial to develop build files using ANT
Tutorial to develop build files using ANT
 
Responsive Web Design: Clever Tips and Techniques
Responsive Web Design: Clever Tips and TechniquesResponsive Web Design: Clever Tips and Techniques
Responsive Web Design: Clever Tips and Techniques
 
Tek 2013 - Building Web Apps from a New Angle with AngularJS
Tek 2013 - Building Web Apps from a New Angle with AngularJSTek 2013 - Building Web Apps from a New Angle with AngularJS
Tek 2013 - Building Web Apps from a New Angle with AngularJS
 
Responsive Web Design: Tips and Tricks
Responsive Web Design: Tips and TricksResponsive Web Design: Tips and Tricks
Responsive Web Design: Tips and Tricks
 
HTTP 2.0 - Web Unleashed 2015
HTTP 2.0 - Web Unleashed 2015HTTP 2.0 - Web Unleashed 2015
HTTP 2.0 - Web Unleashed 2015
 
Levent-Gurses' Introduction to Web Components & Polymer
Levent-Gurses' Introduction to Web Components & PolymerLevent-Gurses' Introduction to Web Components & Polymer
Levent-Gurses' Introduction to Web Components & Polymer
 
Single Page JavaScript WebApps... A Gradle Story
Single Page JavaScript WebApps... A Gradle StorySingle Page JavaScript WebApps... A Gradle Story
Single Page JavaScript WebApps... A Gradle Story
 
Grunt.js and Yeoman, Continous Integration
Grunt.js and Yeoman, Continous IntegrationGrunt.js and Yeoman, Continous Integration
Grunt.js and Yeoman, Continous Integration
 
Rapid Testing, Rapid Development
Rapid Testing, Rapid DevelopmentRapid Testing, Rapid Development
Rapid Testing, Rapid Development
 
Vue js for beginner
Vue js for beginner Vue js for beginner
Vue js for beginner
 
Let Grunt do the work, focus on the fun! [Open Web Camp 2013]
Let Grunt do the work, focus on the fun! [Open Web Camp 2013]Let Grunt do the work, focus on the fun! [Open Web Camp 2013]
Let Grunt do the work, focus on the fun! [Open Web Camp 2013]
 

Similar to Hardboiled Front End Development — Found.ation

Responsive & Responsible: Implementing Responsive Design at Scale
Responsive & Responsible: Implementing Responsive Design at ScaleResponsive & Responsible: Implementing Responsive Design at Scale
Responsive & Responsible: Implementing Responsive Design at Scalescottjehl
 
Building Performance - ein Frontend-Build-Prozess für Java mit Maven
Building Performance - ein Frontend-Build-Prozess für Java mit MavenBuilding Performance - ein Frontend-Build-Prozess für Java mit Maven
Building Performance - ein Frontend-Build-Prozess für Java mit MavenOliver Ochs
 
EnterJS 2015 - Continuous Integration for Frontend Code
EnterJS 2015 - Continuous Integration for Frontend CodeEnterJS 2015 - Continuous Integration for Frontend Code
EnterJS 2015 - Continuous Integration for Frontend CodeMarcel Birkner
 
RESS – Responsive Webdesign and Server Side Components
RESS – Responsive Webdesign and Server Side ComponentsRESS – Responsive Webdesign and Server Side Components
RESS – Responsive Webdesign and Server Side ComponentsSven Wolfermann
 
The New UI - Staying Strong with Flexbox, SASS, and {{Mustache.js}}
The New UI - Staying Strong with Flexbox, SASS, and {{Mustache.js}}The New UI - Staying Strong with Flexbox, SASS, and {{Mustache.js}}
The New UI - Staying Strong with Flexbox, SASS, and {{Mustache.js}}Eric Carlisle
 
Front End Workflow
Front End WorkflowFront End Workflow
Front End WorkflowMatt Bailey
 
CSMess to OOCSS: Refactoring CSS with Object Oriented Design
CSMess to OOCSS: Refactoring CSS with Object Oriented DesignCSMess to OOCSS: Refactoring CSS with Object Oriented Design
CSMess to OOCSS: Refactoring CSS with Object Oriented DesignKate Travers
 
Introducing grunt, npm and sass
Introducing grunt, npm and sassIntroducing grunt, npm and sass
Introducing grunt, npm and sasspriyanka1452
 
TDC2017 | Florianopolis - Trilha DevOps How we figured out we had a SRE team ...
TDC2017 | Florianopolis - Trilha DevOps How we figured out we had a SRE team ...TDC2017 | Florianopolis - Trilha DevOps How we figured out we had a SRE team ...
TDC2017 | Florianopolis - Trilha DevOps How we figured out we had a SRE team ...tdc-globalcode
 
CSS Workflow. Pre & Post
CSS Workflow. Pre & PostCSS Workflow. Pre & Post
CSS Workflow. Pre & PostAnton Dosov
 
Advanced Front End Architecture in D8: Sass, Gulp, & Living Style Guides
Advanced Front End Architecture in D8: Sass, Gulp, & Living Style GuidesAdvanced Front End Architecture in D8: Sass, Gulp, & Living Style Guides
Advanced Front End Architecture in D8: Sass, Gulp, & Living Style GuidesAidan Foster
 
Creating Responsive Drupal Sites with Zen Grids and the Zen 5 Theme
Creating Responsive Drupal Sites with Zen Grids and the Zen 5 ThemeCreating Responsive Drupal Sites with Zen Grids and the Zen 5 Theme
Creating Responsive Drupal Sites with Zen Grids and the Zen 5 ThemeAcquia
 
CSS Architecture - JSIL.pdf
CSS Architecture - JSIL.pdfCSS Architecture - JSIL.pdf
CSS Architecture - JSIL.pdfJonDan6
 
以Vue開發電子商務網站
架構與眉角
以Vue開發電子商務網站
架構與眉角以Vue開發電子商務網站
架構與眉角
以Vue開發電子商務網站
架構與眉角Mei-yu Chen
 
Responsive Design from problem to production
Responsive Design from problem to productionResponsive Design from problem to production
Responsive Design from problem to productionDavid Douglas
 
Web Frontend development: tools and good practices to (re)organize the chaos
Web Frontend development: tools and good practices to (re)organize the chaosWeb Frontend development: tools and good practices to (re)organize the chaos
Web Frontend development: tools and good practices to (re)organize the chaosMatteo Papadopoulos
 

Similar to Hardboiled Front End Development — Found.ation (20)

Death of a Themer
Death of a ThemerDeath of a Themer
Death of a Themer
 
Responsive & Responsible: Implementing Responsive Design at Scale
Responsive & Responsible: Implementing Responsive Design at ScaleResponsive & Responsible: Implementing Responsive Design at Scale
Responsive & Responsible: Implementing Responsive Design at Scale
 
Building Performance - ein Frontend-Build-Prozess für Java mit Maven
Building Performance - ein Frontend-Build-Prozess für Java mit MavenBuilding Performance - ein Frontend-Build-Prozess für Java mit Maven
Building Performance - ein Frontend-Build-Prozess für Java mit Maven
 
EnterJS 2015 - Continuous Integration for Frontend Code
EnterJS 2015 - Continuous Integration for Frontend CodeEnterJS 2015 - Continuous Integration for Frontend Code
EnterJS 2015 - Continuous Integration for Frontend Code
 
RESS – Responsive Webdesign and Server Side Components
RESS – Responsive Webdesign and Server Side ComponentsRESS – Responsive Webdesign and Server Side Components
RESS – Responsive Webdesign and Server Side Components
 
The New UI - Staying Strong with Flexbox, SASS, and {{Mustache.js}}
The New UI - Staying Strong with Flexbox, SASS, and {{Mustache.js}}The New UI - Staying Strong with Flexbox, SASS, and {{Mustache.js}}
The New UI - Staying Strong with Flexbox, SASS, and {{Mustache.js}}
 
Front End Workflow
Front End WorkflowFront End Workflow
Front End Workflow
 
Css framework
Css frameworkCss framework
Css framework
 
Css framework
Css frameworkCss framework
Css framework
 
CSMess to OOCSS: Refactoring CSS with Object Oriented Design
CSMess to OOCSS: Refactoring CSS with Object Oriented DesignCSMess to OOCSS: Refactoring CSS with Object Oriented Design
CSMess to OOCSS: Refactoring CSS with Object Oriented Design
 
Team styles
Team stylesTeam styles
Team styles
 
Introducing grunt, npm and sass
Introducing grunt, npm and sassIntroducing grunt, npm and sass
Introducing grunt, npm and sass
 
TDC2017 | Florianopolis - Trilha DevOps How we figured out we had a SRE team ...
TDC2017 | Florianopolis - Trilha DevOps How we figured out we had a SRE team ...TDC2017 | Florianopolis - Trilha DevOps How we figured out we had a SRE team ...
TDC2017 | Florianopolis - Trilha DevOps How we figured out we had a SRE team ...
 
CSS Workflow. Pre & Post
CSS Workflow. Pre & PostCSS Workflow. Pre & Post
CSS Workflow. Pre & Post
 
Advanced Front End Architecture in D8: Sass, Gulp, & Living Style Guides
Advanced Front End Architecture in D8: Sass, Gulp, & Living Style GuidesAdvanced Front End Architecture in D8: Sass, Gulp, & Living Style Guides
Advanced Front End Architecture in D8: Sass, Gulp, & Living Style Guides
 
Creating Responsive Drupal Sites with Zen Grids and the Zen 5 Theme
Creating Responsive Drupal Sites with Zen Grids and the Zen 5 ThemeCreating Responsive Drupal Sites with Zen Grids and the Zen 5 Theme
Creating Responsive Drupal Sites with Zen Grids and the Zen 5 Theme
 
CSS Architecture - JSIL.pdf
CSS Architecture - JSIL.pdfCSS Architecture - JSIL.pdf
CSS Architecture - JSIL.pdf
 
以Vue開發電子商務網站
架構與眉角
以Vue開發電子商務網站
架構與眉角以Vue開發電子商務網站
架構與眉角
以Vue開發電子商務網站
架構與眉角
 
Responsive Design from problem to production
Responsive Design from problem to productionResponsive Design from problem to production
Responsive Design from problem to production
 
Web Frontend development: tools and good practices to (re)organize the chaos
Web Frontend development: tools and good practices to (re)organize the chaosWeb Frontend development: tools and good practices to (re)organize the chaos
Web Frontend development: tools and good practices to (re)organize the chaos
 

Recently uploaded

Hostel management system project report..pdf
Hostel management system project report..pdfHostel management system project report..pdf
Hostel management system project report..pdfKamal Acharya
 
Unleashing the Power of the SORA AI lastest leap
Unleashing the Power of the SORA AI lastest leapUnleashing the Power of the SORA AI lastest leap
Unleashing the Power of the SORA AI lastest leapRishantSharmaFr
 
S1S2 B.Arch MGU - HOA1&2 Module 3 -Temple Architecture of Kerala.pptx
S1S2 B.Arch MGU - HOA1&2 Module 3 -Temple Architecture of Kerala.pptxS1S2 B.Arch MGU - HOA1&2 Module 3 -Temple Architecture of Kerala.pptx
S1S2 B.Arch MGU - HOA1&2 Module 3 -Temple Architecture of Kerala.pptxSCMS School of Architecture
 
Block diagram reduction techniques in control systems.ppt
Block diagram reduction techniques in control systems.pptBlock diagram reduction techniques in control systems.ppt
Block diagram reduction techniques in control systems.pptNANDHAKUMARA10
 
Tamil Call Girls Bhayandar WhatsApp +91-9930687706, Best Service
Tamil Call Girls Bhayandar WhatsApp +91-9930687706, Best ServiceTamil Call Girls Bhayandar WhatsApp +91-9930687706, Best Service
Tamil Call Girls Bhayandar WhatsApp +91-9930687706, Best Servicemeghakumariji156
 
A CASE STUDY ON CERAMIC INDUSTRY OF BANGLADESH.pptx
A CASE STUDY ON CERAMIC INDUSTRY OF BANGLADESH.pptxA CASE STUDY ON CERAMIC INDUSTRY OF BANGLADESH.pptx
A CASE STUDY ON CERAMIC INDUSTRY OF BANGLADESH.pptxmaisarahman1
 
School management system project Report.pdf
School management system project Report.pdfSchool management system project Report.pdf
School management system project Report.pdfKamal Acharya
 
DeepFakes presentation : brief idea of DeepFakes
DeepFakes presentation : brief idea of DeepFakesDeepFakes presentation : brief idea of DeepFakes
DeepFakes presentation : brief idea of DeepFakesMayuraD1
 
1_Introduction + EAM Vocabulary + how to navigate in EAM.pdf
1_Introduction + EAM Vocabulary + how to navigate in EAM.pdf1_Introduction + EAM Vocabulary + how to navigate in EAM.pdf
1_Introduction + EAM Vocabulary + how to navigate in EAM.pdfAldoGarca30
 
DC MACHINE-Motoring and generation, Armature circuit equation
DC MACHINE-Motoring and generation, Armature circuit equationDC MACHINE-Motoring and generation, Armature circuit equation
DC MACHINE-Motoring and generation, Armature circuit equationBhangaleSonal
 
Standard vs Custom Battery Packs - Decoding the Power Play
Standard vs Custom Battery Packs - Decoding the Power PlayStandard vs Custom Battery Packs - Decoding the Power Play
Standard vs Custom Battery Packs - Decoding the Power PlayEpec Engineered Technologies
 
Kuwait City MTP kit ((+919101817206)) Buy Abortion Pills Kuwait
Kuwait City MTP kit ((+919101817206)) Buy Abortion Pills KuwaitKuwait City MTP kit ((+919101817206)) Buy Abortion Pills Kuwait
Kuwait City MTP kit ((+919101817206)) Buy Abortion Pills Kuwaitjaanualu31
 
Moment Distribution Method For Btech Civil
Moment Distribution Method For Btech CivilMoment Distribution Method For Btech Civil
Moment Distribution Method For Btech CivilVinayVitekari
 
Wadi Rum luxhotel lodge Analysis case study.pptx
Wadi Rum luxhotel lodge Analysis case study.pptxWadi Rum luxhotel lodge Analysis case study.pptx
Wadi Rum luxhotel lodge Analysis case study.pptxNadaHaitham1
 
A Study of Urban Area Plan for Pabna Municipality
A Study of Urban Area Plan for Pabna MunicipalityA Study of Urban Area Plan for Pabna Municipality
A Study of Urban Area Plan for Pabna MunicipalityMorshed Ahmed Rahath
 
Verification of thevenin's theorem for BEEE Lab (1).pptx
Verification of thevenin's theorem for BEEE Lab (1).pptxVerification of thevenin's theorem for BEEE Lab (1).pptx
Verification of thevenin's theorem for BEEE Lab (1).pptxchumtiyababu
 
data_management_and _data_science_cheat_sheet.pdf
data_management_and _data_science_cheat_sheet.pdfdata_management_and _data_science_cheat_sheet.pdf
data_management_and _data_science_cheat_sheet.pdfJiananWang21
 
NO1 Top No1 Amil Baba In Azad Kashmir, Kashmir Black Magic Specialist Expert ...
NO1 Top No1 Amil Baba In Azad Kashmir, Kashmir Black Magic Specialist Expert ...NO1 Top No1 Amil Baba In Azad Kashmir, Kashmir Black Magic Specialist Expert ...
NO1 Top No1 Amil Baba In Azad Kashmir, Kashmir Black Magic Specialist Expert ...Amil baba
 

Recently uploaded (20)

Cara Menggugurkan Sperma Yang Masuk Rahim Biyar Tidak Hamil
Cara Menggugurkan Sperma Yang Masuk Rahim Biyar Tidak HamilCara Menggugurkan Sperma Yang Masuk Rahim Biyar Tidak Hamil
Cara Menggugurkan Sperma Yang Masuk Rahim Biyar Tidak Hamil
 
Hostel management system project report..pdf
Hostel management system project report..pdfHostel management system project report..pdf
Hostel management system project report..pdf
 
Unleashing the Power of the SORA AI lastest leap
Unleashing the Power of the SORA AI lastest leapUnleashing the Power of the SORA AI lastest leap
Unleashing the Power of the SORA AI lastest leap
 
S1S2 B.Arch MGU - HOA1&2 Module 3 -Temple Architecture of Kerala.pptx
S1S2 B.Arch MGU - HOA1&2 Module 3 -Temple Architecture of Kerala.pptxS1S2 B.Arch MGU - HOA1&2 Module 3 -Temple Architecture of Kerala.pptx
S1S2 B.Arch MGU - HOA1&2 Module 3 -Temple Architecture of Kerala.pptx
 
Block diagram reduction techniques in control systems.ppt
Block diagram reduction techniques in control systems.pptBlock diagram reduction techniques in control systems.ppt
Block diagram reduction techniques in control systems.ppt
 
Tamil Call Girls Bhayandar WhatsApp +91-9930687706, Best Service
Tamil Call Girls Bhayandar WhatsApp +91-9930687706, Best ServiceTamil Call Girls Bhayandar WhatsApp +91-9930687706, Best Service
Tamil Call Girls Bhayandar WhatsApp +91-9930687706, Best Service
 
A CASE STUDY ON CERAMIC INDUSTRY OF BANGLADESH.pptx
A CASE STUDY ON CERAMIC INDUSTRY OF BANGLADESH.pptxA CASE STUDY ON CERAMIC INDUSTRY OF BANGLADESH.pptx
A CASE STUDY ON CERAMIC INDUSTRY OF BANGLADESH.pptx
 
School management system project Report.pdf
School management system project Report.pdfSchool management system project Report.pdf
School management system project Report.pdf
 
DeepFakes presentation : brief idea of DeepFakes
DeepFakes presentation : brief idea of DeepFakesDeepFakes presentation : brief idea of DeepFakes
DeepFakes presentation : brief idea of DeepFakes
 
1_Introduction + EAM Vocabulary + how to navigate in EAM.pdf
1_Introduction + EAM Vocabulary + how to navigate in EAM.pdf1_Introduction + EAM Vocabulary + how to navigate in EAM.pdf
1_Introduction + EAM Vocabulary + how to navigate in EAM.pdf
 
DC MACHINE-Motoring and generation, Armature circuit equation
DC MACHINE-Motoring and generation, Armature circuit equationDC MACHINE-Motoring and generation, Armature circuit equation
DC MACHINE-Motoring and generation, Armature circuit equation
 
Standard vs Custom Battery Packs - Decoding the Power Play
Standard vs Custom Battery Packs - Decoding the Power PlayStandard vs Custom Battery Packs - Decoding the Power Play
Standard vs Custom Battery Packs - Decoding the Power Play
 
Kuwait City MTP kit ((+919101817206)) Buy Abortion Pills Kuwait
Kuwait City MTP kit ((+919101817206)) Buy Abortion Pills KuwaitKuwait City MTP kit ((+919101817206)) Buy Abortion Pills Kuwait
Kuwait City MTP kit ((+919101817206)) Buy Abortion Pills Kuwait
 
Moment Distribution Method For Btech Civil
Moment Distribution Method For Btech CivilMoment Distribution Method For Btech Civil
Moment Distribution Method For Btech Civil
 
Wadi Rum luxhotel lodge Analysis case study.pptx
Wadi Rum luxhotel lodge Analysis case study.pptxWadi Rum luxhotel lodge Analysis case study.pptx
Wadi Rum luxhotel lodge Analysis case study.pptx
 
A Study of Urban Area Plan for Pabna Municipality
A Study of Urban Area Plan for Pabna MunicipalityA Study of Urban Area Plan for Pabna Municipality
A Study of Urban Area Plan for Pabna Municipality
 
Verification of thevenin's theorem for BEEE Lab (1).pptx
Verification of thevenin's theorem for BEEE Lab (1).pptxVerification of thevenin's theorem for BEEE Lab (1).pptx
Verification of thevenin's theorem for BEEE Lab (1).pptx
 
data_management_and _data_science_cheat_sheet.pdf
data_management_and _data_science_cheat_sheet.pdfdata_management_and _data_science_cheat_sheet.pdf
data_management_and _data_science_cheat_sheet.pdf
 
NO1 Top No1 Amil Baba In Azad Kashmir, Kashmir Black Magic Specialist Expert ...
NO1 Top No1 Amil Baba In Azad Kashmir, Kashmir Black Magic Specialist Expert ...NO1 Top No1 Amil Baba In Azad Kashmir, Kashmir Black Magic Specialist Expert ...
NO1 Top No1 Amil Baba In Azad Kashmir, Kashmir Black Magic Specialist Expert ...
 
Integrated Test Rig For HTFE-25 - Neometrix
Integrated Test Rig For HTFE-25 - NeometrixIntegrated Test Rig For HTFE-25 - Neometrix
Integrated Test Rig For HTFE-25 - Neometrix
 

Hardboiled Front End Development — Found.ation

  • 1. berlin amsterdam san francisco stuttgart edenspiekermann_ Hardboiled Front End Development Found.ation talk 10th June 2014
  • 2. Hardboiled Front End Development 10.06.2014edenspiekermann_ Introduction Web Developer at Edenspiekermann. ! Previously: – Head of Design @ DailySecret.com. – Head of Front End @ Liberis Publications. ! Enjoys: – CSS architecture. – Refactoring code. 2
  • 3. Hardboiled Front End Development 10.06.2014edenspiekermann_ Contents 1. CSS Architecture –OOCSS. Design modules, not pages. –BEM. Protecting scope. Hacking CSS. –Sass. Enabling modularity. Pitfalls of extending and using mixins. –Living Styleguides. Keeping the mess observable. –Best Practices. Class prefixes, shame.css, z-index.css. ! 2. Javascript Modularity –Modularity. Breaking the $(document).ready long file into modules. –Module Tools. Including functionality on demand with requireJS. –Automating tasks. Automating with Grunt and managing packages with Bower. –Frameworks. Angular, Backbone, a very quick overview. –Little useful tools. Backbone.wreqr, waypoints, owl carousel. 3
  • 5. Hardboiled Front End Development 10.06.2014edenspiekermann_ CSS Architecture CSS Advantages: – Fast, quick to put something out. – Small learning curve. – Easy to override defaults. ! Problems with CSS: – All the above :-). – No inherent modularity. – No scope. – Specificity. 5
  • 7. 7
  • 8. 8
  • 9. 9
  • 10. 10
  • 11.
  • 14. Hardboiled Front End Development 10.06.2014edenspiekermann_ CSS Architecture ! – Decouple Structure from Skin. – Modifier classes. – File structuring flexibility. – Tackle Specificity issue (completely). 14 SMACSS ✓ ✓ × × OOCSS ✓ × ✓ ×
  • 19. Hardboiled Front End Development 10.06.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: we can’t keep track of specificity throughout a CSS document. 19
  • 20. Hardboiled Front End Development 10.06.2014edenspiekermann_ .o-square {! height: 100px;! width: 100px;! }! ! .o-square--black {! background-color: black;! }! ! .o-square--green {! background-color: green;! }! ! .o-square__inner-circle {! border-radius: 100%;! }! ! .o-square__inner-circle--blue {! background-color: blue;! }! CSS Architecture Enter BEM. – BEM stands for Block Element Modifier. – Works like this: .block _ _ element - - modifier – Self explanatory in both HTML & CSS. – Shields object’s scope. ! Things to remember: – Never nest selectors (to ensure specificity == 1). – Always & only, use classes. – One object per file. 20
  • 22. Hardboiled Front End Development 10.06.2014edenspiekermann_ CSS Architecture Advantages: – Nice overview of all your objects. – Enforces good practices. – Enhances developer — designer collaboration. – Helpful for context free development. ! Challenges: – Hard to initially set up. – If not set up correctly, can have dulicate views in production & styleguide. – Same object, different data issues. ! Tools: – https://github.com/kneath/kss – http://livingstyleguide.org – http://kaleistyleguide.com/ 22
  • 23. Hardboiled Front End Development 10.06.2014edenspiekermann_ gem install kss CSS Architecture Setting up KSS. – Install gem. 23
  • 24. 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. 24
  • 25. Hardboiled Front End Development 10.06.2014edenspiekermann_ CSS Architecture Setting up KSS. – Install gem. – Parse CSS folder into an object. – Iterate object in view. 25 - @styleguides.each do |styleguide|! - [...]!
  • 26. 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. 26
  • 28. Hardboiled Front End Development 10.06.2014edenspiekermann_ CSS Architecture Sass enables: – Modular file structure with @import globbing. – Eliminating inconsistencies. Vars for colours, typographic rythm units, breakpoints, animation durations. ! Pitfalls: – “Mixins” print content inside of rule. Duplicate content. – “Extends” group selectors where used. Rules are moved out of intended place, watch out for split CSS files. – Slow compiling of too many files, in Rails. Use libsass. 28
  • 30. Hardboiled Front End Development 10.06.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. – Use “is-” for dynamic states, induced by JS. For different kinds of states, use BEM modifiers. – 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. 30
  • 33. Hardboiled Front End Development 10.06.2014edenspiekermann_ $(document).ready(function() {! ! $(window).on('resize', resizeHandler);! app.windowWidth = $window.width();! app.windowHeight = $window.height();! ! $(window).on("resizestart", function(){! app.vent.trigger('fs:resize-start', app.windowWidth, app.windowHeight);! }).on("resizestop", function(){! app.vent.trigger('fs:resize-stop', app.windowWidth, app.windowHeight);! });! ! //Scrolling event, debounced at 500ms! $(window).on("scroll", function(){! var scrollFunc = _.debounce(function() {! app.vent.trigger('fs:scroll', $ (this).scrollTop());! }, 500);! scrollFunc();! });! ! // Show the targeted offscreen panel by emitting the offscreen-panel:show event.! // Creates one offscreen panel if it doesn't exist already (as in editor or languages list)! $(document).on('click', ".js-show- offscreen-panel, .js-family-finder- trigger", function(event){! Breaking long script files into chunks Traditional approach: one long file – Variable scope problems. – Duplicate logic. – Error prone. – Impossible to maintain. 33
  • 34. edenspiekermann_ Axiom: Projects will ALWAYS scale. https://www.flickr.com/photos/astrid/2583356797
  • 35. Hardboiled Front End Development 10.06.2014edenspiekermann_ ...! ! <script src="jquery.js"></script>! <script src="module1.js"></script>! <script src="module2.js"></script>! <script src="module3.js"></script>! ! </body>! </html>! Breaking long script files into chunks Alternative approach: Split & Include manually – Too much manual labour. – How do you handle common dependencies? – Conflicts in the global object. – Order of loading is important. 35
  • 36. Hardboiled Front End Development 10.06.2014edenspiekermann_ define([ Breaking long script files into chunks Better approach: Modularize everything – Create a new file and define a module. 36
  • 37. Hardboiled Front End Development 10.06.2014edenspiekermann_ define([! "jquery",! "jquery-ui"! ],! function ($, jqueryUI) {! Breaking long script files into chunks Better approach: Modularize everything – Create a new file and define a module. – State its dependencies. 37
  • 38. Hardboiled Front End Development 10.06.2014edenspiekermann_ define([! "jquery",! "jquery-ui"! ],! function ($, jqueryUI) {! ! var init = function (options) {! //...implement logic! };! ! init(options);! ! });! Breaking long script files into chunks Better approach: Modularize everything – Create a new file and define a module. – State its dependencies. – Implement your logic. 38
  • 39. Hardboiled Front End Development 10.06.2014edenspiekermann_ JS Module Creation Tools – requireJS. http://requirejs.org – Browserify. http://browserify.org – Webpack. http://webpack.github.io 39
  • 41. Hardboiled Front End Development 10.06.2014edenspiekermann_ module.exports = function(grunt) {! ! // Load libs! grunt.loadNpmTasks('grunt-watch');! grunt.loadNpmTasks('grunt-jshint');! grunt.loadNpmTasks('grunt-requirejs');! ! // Project configuration.! grunt.initConfig({! pkg: '<json:package.json>',! jshint: {! options: {! curly: true,! eqnull: true,! browser: true,! sub: true,! boss: true! }! }! ! // Define task.! grunt.registerTask('syntax', ['jshint:src']);};! Automating tasks with Grunt (http://gruntjs.com) Things you can do: – Get immediate feedback on syntax errors. – Live reload project. – Minify, uglify, pack code. – Also, use requireJS optimizer. – libSass. Blazingly fast Sass compilation. – Image compression. –Control everything from one config file: gruntfile.js ! – Alternative: Gulp (http://gulpjs.com). Lot of buzz lately. 41
  • 42. Hardboiled Front End Development 10.06.2014edenspiekermann_ {! "name": "Fontshop Relaunch",! "version": "1",! "dependencies": {! "fittext": "",! "jquery": "1.11",! "underscore": "",! "backbone": "",! "backbone.wreqr": "",! "backbone.marionette": "",! "modernizr": "",! "picturefill": "",! "jquery-waypoints": "",! "jquery-sortable": "",! "OwlCarousel": "",! "jasmine.async": "",! "angular": "",! "angular-chosen-localytics": "",! "angular-local-storage": "",! "ng-clip": "",! "zeroclipboard": ""! }! }! Manage Dependencies with Bower (http://bower.io) Things you can do: – Manage dependencies from one file. – You can specify version of scripts. – You can change folder (to fit your folder structuring). ! Things you can’t do: – Include in page automatically. Use requireJS for that :). 42
  • 43. A wee bit of JS frameworks & tools. edenspiekermann_
  • 44. Hardboiled Front End Development 10.06.2014edenspiekermann_ Backbone and Angular in Fontshop. 1. Backbone – FS wasn’t an SPA. Used Backbone as a structuring tool for our JS modules. – Helpful events object, this.$(“…”) selector, initializers. – Create multiple instances easily. – Enforces good OO practices. ! 2. Angular – Used it in the tryout (http://next.fontshop.com/tryout) section. – No boilerplate code. – Provides one point of change (Model). – Very quick to set functionality up. 44
  • 45. Hardboiled Front End Development 10.06.2014edenspiekermann_ Some small favorite scripts :) Backbone.wreqr (https://github.com/marionettejs/backbone.wreqr) – True events based apps. – Enable true modularity. ! Waypoints (http://imakewebthings.com/jquery-waypoints) – No more scrolling window, object, offset calculations. – Also, sticky headers, easily done. ! owlCarousel (http://www.owlgraphic.com/owlcarousel) – Touch based (draggable). – Responsive be default. – Uses CSS 3D transforms, where possible. ! 45
  • 46. 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