SlideShare a Scribd company logo
1 of 56
Download to read offline
THE BACKEND
OF FRONTEND
Marc van Gend
DrupalJam 2014
today, we're going to talkabout
COOKING
OK. Notreally.
first, let's talkabout
YOU & ME
Show of hands...
Who likes to cook?
Do you consider yourself a front-ender or themer?
Do you ever wonder which tools and libraries to use?
Marc van Gend (@marcvangend)
Web developer atTriquanta, Amsterdam, NL
today, we're going to talkabout
FRONT END
DEVELOPMENT
Notepad
Frontend developmentis changing rapidly.
dependencies (libraries)
naming things
inconsistencies (IE, anyone?)
maintainability
SOLUTION?
InstallRuby
InstallGems
InstallNodeJS
InstallPackages
Run it
If itbreaks... Installmore.
SCARY STUFF
Let's juststick with notepad?
Choose whatworks for you.
butseriously:
FRONTEND = COOKING
Processing and combining ingredients in the rightorder.
INGREDIENTS
HTML
CSS
Javascript
Fonts
SVG
Flash
BEING A FRONT END
CHEF
Recipes … Libraries
Utensils … Tools
Cuisine … Methodology
TODAY'S MENU
Methodology, Tools &Libraries:
Stuff thatworks for me
Some practicalexamples
Alternatives thatwork for others
Apeek into the future
How it's used in Drupal
METHODOLOGY (CUISINE)
HAVING A STRATEGY FOR QUALITY
QUALITY
Modular
Reusable
Understandable
Performant
Cross-browser /Cross-device
HTML: SEMANTIC
MARKUP
Nothing new, butwe're getting closer
HTML5 adoption is increasing
CSS: GET ORGANIZED
OOCSS:ObjectOriented CSS
Smacss:Scalable and Modular Architecture for CSS
BEM:Block, Element, Modifier
CSS: OOCSS
Abstracting css into classes
.button{
background:red;
padding:10px;
}
<inputtype="submit"class="button">Submit</input>
<aclass="button">Subscribenow</a>
Notverysemantic, notDrupalfriendly
Nicole Sullivan, http://www.stubbornella.org
CSS: BEM
Block
Element( __)
Modifier ( --)
.menu{}
.menu__item{}
.menu__item--active{}
.block--collapsed__title{}
StillnotDrupalfriendly.
Yandex, http://bem.info
CSS: SMACSS
Base
Layout
Module
State
Theme
Expectto see them in D8!(*.libraries.yml)
Jonathan Snook, http://www.smacss.com
JS: IT DEPENDS
Declaring asynchronouslyloading dependencies in your JS code
CommonJS
AMD (Asynchronous Module Definition)
define(["jquery","drupal"],function($,Drupal){
Drupal.behaviors.myCustomBehavior={
attach:function(context,settings){
$('#my-element',context).doFunkyStuff();
},
};
});
JS: FUTURE
Drupal8: *.libraries.yml
jquery.form:
remote:https://github.com/malsup/form
version:3.39
js:
assets/vendor/jquery-form/jquery.form.js:{}
dependencies:
-core/jquery
-core/jquery.cookie
thanks _nod!
AMD in D9:drupal.org/node/1542344
TOOLS (UTENSILS)
UTENSILS DON'T END UP IN YOUR FOOD
SASS$drupal-blue:#0073ba;
.drupal{
color:$drupal-blue;
a{
color:darken($drupal-blue,20%);
}
}
↧
.drupal{
color:#0073ba;
}
.drupala{
color:#003454;
}
Reusable, maintainable, organized CSS.
SASS: FUTURE 3.3
maps ("associative arrays")
a more flexible parentselector ( &)
the @at-rootdirective
Expectupdated libraries!
SASS: ALTERNATIVES
Less
Stylus
COFFEESCRIPT
"Sass for JavaScript"
foriin[0..5]
console.log"Hello#{i}"
↧
(function(){
vari;
for(i=0;i<=5;i++){
console.log("Hello"+i);
}
}).call(this);
JSHINT
Detectproblems in JS code:
errors
potentialerrors
coding standards violations
optimizations
GRUNT
NodeJS based task runner:
sass /scss changed → compile CSS → trigger LiveReload
readyfor release → re-compile CSS → JSHint→ minifyJS
templates:{
files:[
'template.php',
'templates/**'
]
}
GRUNT: ALTERNATIVES
Guard, Like GruntbutRuby
Gulp,
faster than Grunt
easier syntax
http://guardgem.org
http://gulpjs.com
BUNDLER
Dependencymanagementfor rubygems.
gem'bundler','~>1.5.2'
gem'compass','~>0.12.2'
gem'singularitygs','~>1.1'
gem'breakpoint','~>2.0'
Usage:
$bundleexeccompasswatch
LIVERELOAD
Automaticallyupdate your browser
No browser plugins when used with Grunt
Even works with IE9 in a VM!
functionMYTHEME_css_alter(&$css){
//ForceCSStobeaddedwithlinktags,ratherthan@import.
//Otherwise,Chrome+inspector+livereload=crash.
foreach($cssas$key=>$value){
$css[$key]['preprocess']=FALSE;
}
}
BUT WAIT, THERE'S
MORE!
BOWER
Frontend package manager, http://bower.io
YEOMAN
Scaffolding toolfor webapps, http://yeoman.io
ASSETIC
Symfony's assetmanager,
LIBRARIES (RECIPES)
TRIED AND TESTED
COMBINATIONS OF INGREDIENTS
JQUERY
...and plugins
...and jQueryUI
COMPASS
Libraryof Sass mixins and extensions, .http://compass-style.org
create image sprites
cross-browser CSS
Ever wondered where Sass ends and Compass begins?
COMPASS: EXAMPLE
.box-shadow{
@includebox-shadow(red2px2px10px);
}
↧
.box-shadow{
-webkit-box-shadow:red2px2px10px;
-moz-box-shadow:red2px2px10px;
box-shadow:red2px2px10px;
}
COMPASS: ALTERNATIVE
Bourbon, http://bourbon.io
COMPASS: FUTURE
Compass 1.0
SUSY
ASass-based semantic grid system, http://susy.oddbird.net
No more:
<divid="main"class="grid_6prefix_2suffix_4">
Whatifyouhaveonly4columnsonmobile?
</div>
SUSY: EXAMPLE
$susy:(
columns:7,
gutters:1/5,
);
#page{@includecontainer(80em);}
#main{@includespan(last5);}
SUSY: FUTURE
Susy2 is here!
SUSY: ALTERNATIVES
SingularityGS,
Zen Grids,
...
http://singularity.gs
http://zengrids.com
BREAKPOINT
Easymedia queries with Sass, http://breakpoint-sass.com/
Used bygrid systems like Susyand Singularity.
BREAKPOINT: EXAMPLE
$breakpoint-medium:500px;
.foo{
padding:10px;
@includebreakpoint($breakpoint-medium){
padding:20px;
}
}
↧
.foo{padding:10px;}
@media(min-width:500px){
.foo{padding:20px;}
}
MODERNIZR
HTML5 and CSS3 feature detection, http://modernizr.com
Drupal8:in core.
MODERNIZR: EXAMPLE
CSS:
.multiplebgsbody{
background:url(background-1.png)topleftrepeat-x,
url(background-2.png)bottomleftrepeat-x;
}
JS:
if(Modernizr.geolocation){
//Dogeolocationstuff...
}
BUT WAIT, THERE'S
MORE!
POLYFILLS
HTML5 shiv, - D8 core
Respond JS,
https://code.google.com/p/html5shiv
https://github.com/scottjehl/Respond
DATA VISUALIZATION
RaphaëlJS,
Processing JS,
http://raphaeljs.com
http://processingjs.org
WAIT, THERE'S STILL
MORE!
JS-BASED MVC FRAMEWORKS
Backbone JS (&Underscore), - D8 core
Angular JS,
http://backbonejs.org
http://angularjs.org
JS SCRIPT LOADERS
Require.js,
Browserify,
JS scriptloaders in D9:drupal.org/node/1033392
http://requirejs.org
http://browserify.org
DRUPAL
Can I startusing this tomorrow?
CLEAN(ER) MARKUP
Do yourself a favor!
Fences,
DisplaySuite,
Certain base themes
Views configuration
https://drupal.org/project/fences
https://drupal.org/project/ds
CLEAN(ER) MARKUP: FUTURE
Drupal8 says (drupal.org/node/1833912):
Use classes for css
<divclass="highlight">Iwillbestyled</div>
Use data attributes for JS.
<divdata-animation="fade-in">Iwillbeanimated</div>
JQUERY UPDATE
Tip:use 7.x-2.x-dev
includes 1.9 and 1.10
differentjQueryversion for admin pages
BASE THEMES
Pre-configured best-practice powerhouses.
BASE THEMES: AURORA
Grunt(opt-in)
Bower (opt-in)
Bundler
LiveReload
Singularity
sub theme scaffolding:Aurora Gem
maintained bySam Richards (snugug, Singularity) and Ian
Carrico (ChinggizKhan)
BASE THEMES: OMEGA
Gruntand Guard
Bower
Bundler and RVM
LiveReload
Susy
sub theme scaffolding:Drush
maintained bySebastian Siemssen (fubhy) and MattSmith
(splatio)
MAGIC
Collaboration oof Aurora and Omega maintainers
Excluding core CSS/JS files
Backportof Drupal8 JavaScripthandling
Modernizr indicator
Move Javascriptto the footer
BREAKPOINTS & PICTURE
Responsive images using the <picture>element(W3C
draft)
TellDrupalaboutyour breakpoints
Map breakpoints to image styles
Use in a field formatter
Backported from Drupal8 (responsive_image)
PICTURE: EXAMPLE
<picture>
<sourcemedia="(min-width:45em)"srcset="large.jpg">
<sourcemedia="(min-width:18em)"srcset="medium.jpg">
<imgsrc="small.jpg"alt="Thepictureelementisfun.">
</picture>
WRAPPING UP
The juryis stillout.
You can join the jury.
Justdon'tbe scared.
THANK YOU
for being awesome
QUESTIONS?

More Related Content

What's hot

WHAT / WHY / HOW WE’RE ENGINEERING AT SMARTSTUDY (English)
WHAT / WHY / HOW WE’RE ENGINEERING AT SMARTSTUDY (English)WHAT / WHY / HOW WE’RE ENGINEERING AT SMARTSTUDY (English)
WHAT / WHY / HOW WE’RE ENGINEERING AT SMARTSTUDY (English)
Hyun-woo Park
 

What's hot (18)

Pipenv: Python Dev Workflow for Humans
Pipenv: Python Dev Workflow for HumansPipenv: Python Dev Workflow for Humans
Pipenv: Python Dev Workflow for Humans
 
Bower & Grunt - A practical workflow
Bower & Grunt - A practical workflowBower & Grunt - A practical workflow
Bower & Grunt - A practical workflow
 
JavaScript development methodology
JavaScript development methodologyJavaScript development methodology
JavaScript development methodology
 
Advanced front-end automation with npm scripts
Advanced front-end automation with npm scriptsAdvanced front-end automation with npm scripts
Advanced front-end automation with npm scripts
 
WHAT / WHY / HOW WE’RE ENGINEERING AT SMARTSTUDY (English)
WHAT / WHY / HOW WE’RE ENGINEERING AT SMARTSTUDY (English)WHAT / WHY / HOW WE’RE ENGINEERING AT SMARTSTUDY (English)
WHAT / WHY / HOW WE’RE ENGINEERING AT SMARTSTUDY (English)
 
Profiling PHP with Xdebug / Webgrind
Profiling PHP with Xdebug / WebgrindProfiling PHP with Xdebug / Webgrind
Profiling PHP with Xdebug / Webgrind
 
IC3 -- Configuration Management 101
IC3 -- Configuration Management 101IC3 -- Configuration Management 101
IC3 -- Configuration Management 101
 
Windows Azure loves OSS
Windows Azure loves OSSWindows Azure loves OSS
Windows Azure loves OSS
 
Introduction to Express and Grunt
Introduction to Express and GruntIntroduction to Express and Grunt
Introduction to Express and Grunt
 
Managing windows with Puppet and Chocolatey
Managing windows with Puppet and ChocolateyManaging windows with Puppet and Chocolatey
Managing windows with Puppet and Chocolatey
 
DevOps for Developers
DevOps for DevelopersDevOps for Developers
DevOps for Developers
 
Lecture: Webpack 4
Lecture: Webpack 4Lecture: Webpack 4
Lecture: Webpack 4
 
Future of Web Development
Future of Web DevelopmentFuture of Web Development
Future of Web Development
 
Rapid Templating with Serve
Rapid Templating with ServeRapid Templating with Serve
Rapid Templating with Serve
 
Puppeteer can automate that! - Frontmania
Puppeteer can automate that! - FrontmaniaPuppeteer can automate that! - Frontmania
Puppeteer can automate that! - Frontmania
 
Easy Step Remove Vgrabber tools
Easy Step Remove Vgrabber toolsEasy Step Remove Vgrabber tools
Easy Step Remove Vgrabber tools
 
Enhancing your catalogue with open source
Enhancing your catalogue with open sourceEnhancing your catalogue with open source
Enhancing your catalogue with open source
 
Introduction to PhoneGap and PhoneGap Build
Introduction to PhoneGap and PhoneGap BuildIntroduction to PhoneGap and PhoneGap Build
Introduction to PhoneGap and PhoneGap Build
 

Similar to The backend-of-frontend Drupaljam 2014

How to? Drupal developer toolkit. Dennis Povshedny.
How to? Drupal developer toolkit. Dennis Povshedny.How to? Drupal developer toolkit. Dennis Povshedny.
How to? Drupal developer toolkit. Dennis Povshedny.
DrupalCampDN
 

Similar to The backend-of-frontend Drupaljam 2014 (20)

Madison PHP 2015 - DevOps For Small Teams
Madison PHP 2015 - DevOps For Small TeamsMadison PHP 2015 - DevOps For Small Teams
Madison PHP 2015 - DevOps For Small Teams
 
ZendCon 2015 - DevOps for Small Teams
ZendCon 2015 - DevOps for Small TeamsZendCon 2015 - DevOps for Small Teams
ZendCon 2015 - DevOps for Small Teams
 
Midwest PHP 2017 DevOps For Small team
Midwest PHP 2017 DevOps For Small teamMidwest PHP 2017 DevOps For Small team
Midwest PHP 2017 DevOps For Small team
 
Automate Yo' Self
Automate Yo' SelfAutomate Yo' Self
Automate Yo' Self
 
Modern Web Application Development Workflow - EclipseCon Europe 2014
Modern Web Application Development Workflow - EclipseCon Europe 2014Modern Web Application Development Workflow - EclipseCon Europe 2014
Modern Web Application Development Workflow - EclipseCon Europe 2014
 
Modern Web Application Development Workflow - EclipseCon France 2014
Modern Web Application Development Workflow - EclipseCon France 2014Modern Web Application Development Workflow - EclipseCon France 2014
Modern Web Application Development Workflow - EclipseCon France 2014
 
Vagrant and puppet: Deployment made easy
Vagrant and puppet: Deployment made easyVagrant and puppet: Deployment made easy
Vagrant and puppet: Deployment made easy
 
CoffeeScript: A beginner's presentation for beginners copy
CoffeeScript: A beginner's presentation for beginners copyCoffeeScript: A beginner's presentation for beginners copy
CoffeeScript: A beginner's presentation for beginners copy
 
Become a webdeveloper - AKAICamp Beginner #1
Become a webdeveloper - AKAICamp Beginner #1Become a webdeveloper - AKAICamp Beginner #1
Become a webdeveloper - AKAICamp Beginner #1
 
DevOps For Small Teams
DevOps For Small TeamsDevOps For Small Teams
DevOps For Small Teams
 
WordPress automation and CI
WordPress automation and CIWordPress automation and CI
WordPress automation and CI
 
How fast can you onboard a new team member with VAGRANT ?
How fast can you onboard a new team member with VAGRANT ?How fast can you onboard a new team member with VAGRANT ?
How fast can you onboard a new team member with VAGRANT ?
 
Front-End Tooling
Front-End ToolingFront-End Tooling
Front-End Tooling
 
How to? Drupal developer toolkit. Dennis Povshedny.
How to? Drupal developer toolkit. Dennis Povshedny.How to? Drupal developer toolkit. Dennis Povshedny.
How to? Drupal developer toolkit. Dennis Povshedny.
 
The Secrets of The FullStack Ninja - Part A - Session I
The Secrets of The FullStack Ninja - Part A - Session IThe Secrets of The FullStack Ninja - Part A - Session I
The Secrets of The FullStack Ninja - Part A - Session I
 
Local development with vvv jon trujillo
Local development with vvv   jon trujilloLocal development with vvv   jon trujillo
Local development with vvv jon trujillo
 
Overcoming Command Line Allergies
Overcoming Command Line AllergiesOvercoming Command Line Allergies
Overcoming Command Line Allergies
 
Drupal development
Drupal development Drupal development
Drupal development
 
S&T What I know about Node 110817
S&T What I know about Node 110817S&T What I know about Node 110817
S&T What I know about Node 110817
 
Automate Yo'self -- SeaGL
Automate Yo'self -- SeaGL Automate Yo'self -- SeaGL
Automate Yo'self -- SeaGL
 

More from Triquanta

More from Triquanta (7)

Showcase Joost DrupalCon Vienna
Showcase Joost DrupalCon ViennaShowcase Joost DrupalCon Vienna
Showcase Joost DrupalCon Vienna
 
Entities in Drupal 8 - Drupal Tech Talk - Bart Feenstra
Entities in Drupal 8 - Drupal Tech Talk - Bart FeenstraEntities in Drupal 8 - Drupal Tech Talk - Bart Feenstra
Entities in Drupal 8 - Drupal Tech Talk - Bart Feenstra
 
Hoe CMI in Drupal features overbodig maakt (of toch niet) - Drupal Tech Talk ...
Hoe CMI in Drupal features overbodig maakt (of toch niet) - Drupal Tech Talk ...Hoe CMI in Drupal features overbodig maakt (of toch niet) - Drupal Tech Talk ...
Hoe CMI in Drupal features overbodig maakt (of toch niet) - Drupal Tech Talk ...
 
Toegankelijke Data
Toegankelijke DataToegankelijke Data
Toegankelijke Data
 
Search met solr
Search met solrSearch met solr
Search met solr
 
Drupal theming met sass, compass, susy en aurora
Drupal theming met sass, compass, susy en auroraDrupal theming met sass, compass, susy en aurora
Drupal theming met sass, compass, susy en aurora
 
Van adlib naar online collectie
Van adlib naar online collectieVan adlib naar online collectie
Van adlib naar online collectie
 

Recently uploaded

Future Visions: Predictions to Guide and Time Tech Innovation, Peter Udo Diehl
Future Visions: Predictions to Guide and Time Tech Innovation, Peter Udo DiehlFuture Visions: Predictions to Guide and Time Tech Innovation, Peter Udo Diehl
Future Visions: Predictions to Guide and Time Tech Innovation, Peter Udo Diehl
Peter Udo Diehl
 
Structuring Teams and Portfolios for Success
Structuring Teams and Portfolios for SuccessStructuring Teams and Portfolios for Success
Structuring Teams and Portfolios for Success
UXDXConf
 

Recently uploaded (20)

AI presentation and introduction - Retrieval Augmented Generation RAG 101
AI presentation and introduction - Retrieval Augmented Generation RAG 101AI presentation and introduction - Retrieval Augmented Generation RAG 101
AI presentation and introduction - Retrieval Augmented Generation RAG 101
 
Choosing the Right FDO Deployment Model for Your Application _ Geoffrey at In...
Choosing the Right FDO Deployment Model for Your Application _ Geoffrey at In...Choosing the Right FDO Deployment Model for Your Application _ Geoffrey at In...
Choosing the Right FDO Deployment Model for Your Application _ Geoffrey at In...
 
A Business-Centric Approach to Design System Strategy
A Business-Centric Approach to Design System StrategyA Business-Centric Approach to Design System Strategy
A Business-Centric Approach to Design System Strategy
 
Future Visions: Predictions to Guide and Time Tech Innovation, Peter Udo Diehl
Future Visions: Predictions to Guide and Time Tech Innovation, Peter Udo DiehlFuture Visions: Predictions to Guide and Time Tech Innovation, Peter Udo Diehl
Future Visions: Predictions to Guide and Time Tech Innovation, Peter Udo Diehl
 
FDO for Camera, Sensor and Networking Device – Commercial Solutions from VinC...
FDO for Camera, Sensor and Networking Device – Commercial Solutions from VinC...FDO for Camera, Sensor and Networking Device – Commercial Solutions from VinC...
FDO for Camera, Sensor and Networking Device – Commercial Solutions from VinC...
 
Powerful Start- the Key to Project Success, Barbara Laskowska
Powerful Start- the Key to Project Success, Barbara LaskowskaPowerful Start- the Key to Project Success, Barbara Laskowska
Powerful Start- the Key to Project Success, Barbara Laskowska
 
ECS 2024 Teams Premium - Pretty Secure
ECS 2024   Teams Premium - Pretty SecureECS 2024   Teams Premium - Pretty Secure
ECS 2024 Teams Premium - Pretty Secure
 
How Red Hat Uses FDO in Device Lifecycle _ Costin and Vitaliy at Red Hat.pdf
How Red Hat Uses FDO in Device Lifecycle _ Costin and Vitaliy at Red Hat.pdfHow Red Hat Uses FDO in Device Lifecycle _ Costin and Vitaliy at Red Hat.pdf
How Red Hat Uses FDO in Device Lifecycle _ Costin and Vitaliy at Red Hat.pdf
 
Syngulon - Selection technology May 2024.pdf
Syngulon - Selection technology May 2024.pdfSyngulon - Selection technology May 2024.pdf
Syngulon - Selection technology May 2024.pdf
 
PLAI - Acceleration Program for Generative A.I. Startups
PLAI - Acceleration Program for Generative A.I. StartupsPLAI - Acceleration Program for Generative A.I. Startups
PLAI - Acceleration Program for Generative A.I. Startups
 
What's New in Teams Calling, Meetings and Devices April 2024
What's New in Teams Calling, Meetings and Devices April 2024What's New in Teams Calling, Meetings and Devices April 2024
What's New in Teams Calling, Meetings and Devices April 2024
 
Secure Zero Touch enabled Edge compute with Dell NativeEdge via FDO _ Brad at...
Secure Zero Touch enabled Edge compute with Dell NativeEdge via FDO _ Brad at...Secure Zero Touch enabled Edge compute with Dell NativeEdge via FDO _ Brad at...
Secure Zero Touch enabled Edge compute with Dell NativeEdge via FDO _ Brad at...
 
Oauth 2.0 Introduction and Flows with MuleSoft
Oauth 2.0 Introduction and Flows with MuleSoftOauth 2.0 Introduction and Flows with MuleSoft
Oauth 2.0 Introduction and Flows with MuleSoft
 
Enterprise Knowledge Graphs - Data Summit 2024
Enterprise Knowledge Graphs - Data Summit 2024Enterprise Knowledge Graphs - Data Summit 2024
Enterprise Knowledge Graphs - Data Summit 2024
 
Integrating Telephony Systems with Salesforce: Insights and Considerations, B...
Integrating Telephony Systems with Salesforce: Insights and Considerations, B...Integrating Telephony Systems with Salesforce: Insights and Considerations, B...
Integrating Telephony Systems with Salesforce: Insights and Considerations, B...
 
Where to Learn More About FDO _ Richard at FIDO Alliance.pdf
Where to Learn More About FDO _ Richard at FIDO Alliance.pdfWhere to Learn More About FDO _ Richard at FIDO Alliance.pdf
Where to Learn More About FDO _ Richard at FIDO Alliance.pdf
 
Extensible Python: Robustness through Addition - PyCon 2024
Extensible Python: Robustness through Addition - PyCon 2024Extensible Python: Robustness through Addition - PyCon 2024
Extensible Python: Robustness through Addition - PyCon 2024
 
Structuring Teams and Portfolios for Success
Structuring Teams and Portfolios for SuccessStructuring Teams and Portfolios for Success
Structuring Teams and Portfolios for Success
 
Top 10 Symfony Development Companies 2024
Top 10 Symfony Development Companies 2024Top 10 Symfony Development Companies 2024
Top 10 Symfony Development Companies 2024
 
Google I/O Extended 2024 Warsaw
Google I/O Extended 2024 WarsawGoogle I/O Extended 2024 Warsaw
Google I/O Extended 2024 Warsaw
 

The backend-of-frontend Drupaljam 2014