SlideShare a Scribd company logo
1 of 86
Download to read offline
FRONTEND 
(re)organize the chaos
FRONTEND 
(re)organize the chaos 
Matteo Papadopoulos 
@spleenteo 
Stefano Verna 
@steffoz 
www.cantierecreativo.net
Asset Pipeline 
a.k.a. Sprockets
Asset Pipeline 
“The new pipeline makes 
assets a first class citizen in the 
Rails stack.”
Asset Pipeline 
gem 'jquery-rails' 
! 
//= require 'jquery'
Asset Pipeline 
2011 Rails 3.1
Asset Pipeline 
2012
Asset Pipeline 
Bower 
Frontend package manager
Asset Pipeline 
+17.000 
packages
Asset Pipeline 
$ npm install -g bower 
$ bower init
Asset Pipeline 
$ cat bower.json 
{ 
"name": "my-project", 
"dependencies": { 
"jquery-ui": "~1.11.1", 
"jquery": "~2.1.1" 
} 
}
Asset Pipeline 
$ tree bower_components -L 1 
./bower_components 
"## jquery 
$## jquery-ui
Asset Pipeline 
So we need two 
package managers?
Asset Pipeline 
Rails Assets 
Frictionless proxy between Bundler and Bower
Asset Pipeline 
source 'https://rubygems.org' 
source 'https://rails-assets.org' 
! 
gem 'rails-assets-jquery-ui'
Asset Pipeline 
Bundler Rails Assets Bower 
do you have 
rails-assets-jquery-ui? 
do you have 
jquery-ui? 
sure thing, 
take it! 
here's the gem!
Asset Pipeline 
win-win 
that was easy.
Asset Pipeline 
Compass 
“A SASS Framework”
Compass 
Asset Pipeline 
vendor prefixes 
typography 
vertical rhythm 
grid 
reset 
helper functions 
image-related features
Compass 
Asset Pipeline 
monolithic 
approach
Asset Pipeline 
Compass soooo slow
Asset Pipeline 
Compass php syndrome
Compass 
Asset Pipeline 
box-shadow: 10px 10px 5px red;
Compass 
Asset Pipeline 
box-shadow: 10px 10px 5px red; 
+box-shadow(red 10px 10px 5px)
Compass 
Asset Pipeline 
vendor prefixes 
typography 
vertical rhythm 
grid 
reset 
helper functions 
image-related features
Asset Pipeline 
Compass vendor prefixes 
image-related features
Asset Pipeline 
Compass unix-like approach
Asset Pipeline 
vendor prefixes
Asset Pipeline 
100% Sass mixin library
Asset Pipeline 
Autoprefixer 
CSS post-processor 
gem 'autoprefixer-rails'
Asset Pipeline 
a { 
display: flex; 
} 
> 1% 
last 2 versions 
Firefox ESR 
Opera 12.1 
a { 
display: -webkit-box; 
display: -webkit-flex; 
display: -moz-box; 
display: -ms-flexbox; 
display: flex 
}
Asset Pipeline 
Compass vendor prefixes 
image-related features
Asset Pipeline 
image-related features 
sprites 
webfont 
high DPI images support 
lossless image compression 
…
Asset Pipeline 
task management tools
Asset Pipeline 
GRUNT GULP BROCCOLI
Asset Pipeline 
+3400 
tasks 
mostly frontend-related
Asset Pipeline 
$ npm install -g grunt-cli
Asset Pipeline 
$ cat package.json 
{ 
"name": "my-project", 
"dependencies": { 
"grunt": "~1.11.1", 
"grunt-bemo": "~2.1.1", 
... 
} 
} 
$ npm install
Asset Pipeline 
# Gruntfile.js 
! 
module.exports = function(grunt) { 
grunt.loadNpmTasks('grunt-bemo'); 
! 
grunt.initConfig({ 
bemo: { 
webfonts: { 
src: "app/assets/fonts/svg", 
fontDest: "app/assets/fonts", 
sassDest: "app/assets/stylesheets/_icon-glyphs.css.scss" 
}, 
sprites: { 
src: "app/assets/images/sprites", 
imageDest: "app/assets/images/sprites-{{density}}.png", 
sassDest: "app/assets/stylesheets/_sprites.css.scss" 
} 
} 
}); 
};
Asset Pipeline 
$ grunt bemo 
! 
Running "bemo-sprites" task 
... 
! 
Running "bemo-webfonts" task 
...
Asset Pipeline 
JS/Coffee code linter 
JS/Coffee code style checker 
Live reload 
SVG/PNG/JPG optimizer 
Inline assets 
Unused CSS removal 
...
Asset Pipeline 
Recap 
Use Bower packages, not gems 
Rails Assets 
Replace Compass 
Bourbon/Autoprefixer 
Grunt/Gulp/Broccoli
Writing Sass
Writing Sass 
Rails conventions 
$ rails generate controller books 
create app/controllers/books_controller.rb 
invoke erb 
create app/views/books 
invoke helper 
create app/helpers/books_helper.rb 
invoke assets 
invoke coffee 
create app/assets/javascripts/books.js.coffee 
invoke scss 
create app/assets/stylesheets/books.css.scss
Writing Sass 
OOCSS 
Object-oriented CSS 
Organize the chaos v1 2012 - http://goo.gl/6ZRJm4
OOCSS 
Writing Sass 
A CSS “object” is a repeating 
visual pattern, that can be 
abstracted into an independent 
snippet of HTML, CSS, and 
possibly JavaScript. That 
object can then be reused 
throughout a site.
Writing Sass
Writing Sass 
media object
Writing Sass 
.media 
display: table 
width: 100% 
! 
.media .img, .media .body 
display: table-cell 
vertical-align: top 
! 
.media .img 
padding-right: 10px 
<div class="media"> 
! 
<div class="img"> 
<img src="..." /> 
</div> 
! 
<div class="body"> 
... 
</div> 
! 
</div>
Writing Sass 
No margins, no positioning, 
100% width 
.media 
display: table 
width: 100% 
! 
.media .img, .media .body 
display: table-cell 
vertical-align: top 
! 
.media .img 
padding-right: 10px
Writing Sass 
Location 
indipendence 
Let the context choose your positioning 
Be fluid: always expand to take the full 
width of the container
Writing Sass 
Just class selectors? 
.media 
display: table 
width: 100% 
! 
.media .img, .media .body 
display: table-cell 
vertical-align: top 
! 
.media .img 
padding-right: 10px
Writing Sass 
ID selectors 
Limit reuse within the same page 
Tag selectors 
Force a semantic 
Carpet bombing
Writing Sass 
.media 
display: table 
width: 100% 
! 
.media .img, .media .body 
display: table-cell 
vertical-align: top 
! 
.media .img 
padding-right: 10px 
Wait, what about 
descendent selectors?
Writing Sass 
Descendent 
selectors 
Carpet bombing (again) 
Potential name clashing
Writing Sass 
Descendent 
selectors 
Do not use them.
Writing Sass 
.media 
display: table 
width: 100% 
! 
.media .img, .media .body 
display: table-cell 
vertical-align: top 
! 
.media__img 
padding-right: 10px
Writing Sass 
.media 
display: table 
width: 100% 
! 
.media__img, .media__body 
display: table-cell 
vertical-align: top 
! 
.media__img 
padding-right: 10px
Writing Sass 
BEM 
Block • Element • Modifier
Writing Sass 
.media 
display: table 
width: 100% 
! 
.media__img, .media__body 
display: table-cell 
vertical-align: top 
! 
.media__img 
padding-right: 10px 
Block (CSS object) 
Block element
Writing Sass 
.nav-bar Block (CSS object) 
.nav-bar__logo Block element
Writing Sass 
.nav-bar Block (CSS object) 
.nav-bar__logo Block element 
.nav-bar--primary Modifier
Writing Sass 
.media 
// .... 
! 
.media--rev 
direction: rtl 
text-align: left 
! 
.media__img 
padding-right: 0px 
padding-left: 10px 
<div class="media media--rev"> 
! 
<div class="media__img"> 
<img src="..." /> 
</div> 
! 
<div class="media__body"> 
... 
</div> 
! 
</div>
Writing Sass 
.nav-bar--primary__logo--dark
Writing Sass 
But it's verbose and 
ugly and...! 
CSS has limited character set. 
Deal with it.
Writing Sass 
Remember the pros! 
No more name clashing 
! 
No more overrides 
! 
Trivial to understand and maintain your 
codebase
Writing Sass 
Structure
Writing Sass 
. 
"## application.css.sass 
"## _base.css.sass 
"## _font-faces.css.sass 
"## blocks 
% "## _button.css.sass 
% "## _media.css.sass 
% $## ... 
"## functions 
% $## ... 
"## mixins 
% $## ... 
$## variables 
$## ... 
Root file
Writing Sass 
. 
"## application.css.sass 
"## _base.css.sass 
"## _font-faces.css.sass 
"## blocks 
% "## _button.css.sass 
% "## _media.css.sass 
% $## ... 
"## functions 
% $## ... 
"## mixins 
% $## ... 
$## variables 
$## ... 
// Silent code 
@import 'functions/**/*' 
@import 'variables/**/*' 
@import 'bourbon' 
@import 'mixins/**/*' 
! 
// Font faces 
@import 'font-faces' 
! 
// Base 
@import 'normalize-scss' 
@import 'base' 
! 
// Blocks 
@import 'blocks/**/*'
Writing Sass 
// Silent code 
@import 'functions/**/*' 
@import 'variables/**/*' 
@import 'bourbon' 
@import 'mixins/**/*' 
! 
// Font faces 
@import 'font-faces' 
! 
// Base 
@import 'normalize-scss' 
@import 'base' 
! 
// Blocks 
@import 'blocks/**/*' 
gem "sass-globbing"
Writing Sass 
. 
"## application.css.sass 
"## _base.css.sass 
"## _font-faces.css.sass 
"## blocks 
% "## _button.css.sass 
% "## _media.css.sass 
% $## ... 
"## functions 
% $## ... 
"## mixins 
% $## ... 
$## variables 
$## ... 
// Silent code 
@import 'functions/**/*' 
@import 'variables/**/*' 
@import 'bourbon' 
@import 'mixins/**/*' 
! 
// Font faces 
@import 'font-faces' 
! 
// Base 
@import 'normalize-scss' 
@import 'base' 
! 
// Blocks 
@import 'blocks/**/*'
. 
"## application.css.sass 
"## _base.css.sass 
"## _font-faces.css.sass 
"## blocks 
% "## _button.css.sass 
% "## _media.css.sass 
% $## ... 
"## functions 
% $## ... 
"## mixins 
% $## ... 
$## variables 
$## ... 
// Silent code 
@import 'functions/**/*' 
@import 'variables/**/*' 
@import 'bourbon' 
@import 'mixins/**/*' 
! 
// Font faces 
@import 'font-faces' 
! 
// Base 
@import 'normalize-scss' 
@import 'base' 
! 
// Formats 
@import 'formats/**/*' 
! 
// Blocks 
@import 'blocks/**/*' 
Writing Sass 
Configuration 
functions 
mixins
// Silent code 
@import 'functions/**/*' 
@import 'variables/**/*' 
@import 'bourbon' 
@import 'mixins/**/*' 
! 
// Font faces 
@import 'font-faces' 
! 
// Base 
@import 'normalize-scss' 
@import 'base' 
! 
// Formats 
@import 'formats/**/*' 
! 
// Blocks 
@import 'blocks/**/*' 
Writing Sass 
. 
"## application.css.sass 
"## _base.css.sass 
"## _font-faces.css.sass 
"## blocks 
% "## _button.css.sass 
% "## _media.css.sass 
% $## ... 
"## functions 
% $## ... 
"## mixins 
% $## ... 
$## variables 
$## ... 
Default styling, 
Basefile
Writing Sass 
html, body 
! 
a 
! 
ul, ol, blockquote 
! 
li 
! 
h1, h2, h3, h4, h5, h6, hgroup, ul, ol, dd, 
p, figure, pre, table, fieldset, hr, form 
! 
input, textarea 
! 
input[type="submit"], button
// Silent code 
@import 'functions/**/*' 
@import 'variables/**/*' 
@import 'bourbon' 
@import 'mixins/**/*' 
! 
// Font faces 
@import 'font-faces' 
! 
// Base 
@import 'normalize-scss' 
@import 'base' 
! 
// Blocks 
@import 'blocks/**/*' 
Writing Sass 
. 
"## application.css.sass 
"## _base.css.sass 
"## _font-faces.css.sass 
"## blocks 
% "## _button.css.sass 
% "## _media.css.sass 
% $## ... 
"## functions 
% $## ... 
"## mixins 
% $## ... 
$## variables 
$## ... 99% of the 
code is here!
Writing Sass 
one block per file 
group blocks into 
subdirectories
Asset Pipeline 
Recap 
Rails per-controller modularity is not 
scalable 
OCCSS is a better solution 
BEM 
How to structure our Rails stylesheets 
directory
Writing Sass 
BEMO
Asset Pipeline 
Bemo 
http://github.com/stefanoverna/bemo 
Project starter/Scaffolder 
Common BEM blocks library 
Grunt tasks for retina-ready sprites and 
web fonts
THANKS! 
question time 
Matteo Papadopoulos 
@spleenteo 
Stefano Verna 
@steffoz

More Related Content

What's hot

Ruby MVC from scratch with Rack
Ruby MVC from scratch with RackRuby MVC from scratch with Rack
Ruby MVC from scratch with RackDonSchado
 
Progressive Enhancement 2.0 (jQuery Conference SF Bay Area 2011)
Progressive Enhancement 2.0 (jQuery Conference SF Bay Area 2011)Progressive Enhancement 2.0 (jQuery Conference SF Bay Area 2011)
Progressive Enhancement 2.0 (jQuery Conference SF Bay Area 2011)Nicholas Zakas
 
Rails Girls: Programming, Web Applications and Ruby on Rails
Rails Girls: Programming, Web Applications and Ruby on RailsRails Girls: Programming, Web Applications and Ruby on Rails
Rails Girls: Programming, Web Applications and Ruby on RailsDonSchado
 
Your own (little) gem: building an online business with Ruby
Your own (little) gem: building an online business with RubyYour own (little) gem: building an online business with Ruby
Your own (little) gem: building an online business with RubyLindsay Holmwood
 
Building Mobile Applications with Ionic
Building Mobile Applications with IonicBuilding Mobile Applications with Ionic
Building Mobile Applications with IonicMorris Singer
 
Realize mais com HTML 5 e CSS 3 - 16 EDTED - RJ
Realize mais com HTML 5 e CSS 3 - 16 EDTED - RJRealize mais com HTML 5 e CSS 3 - 16 EDTED - RJ
Realize mais com HTML 5 e CSS 3 - 16 EDTED - RJLeonardo Balter
 
Bullet: The Functional PHP Micro-Framework
Bullet: The Functional PHP Micro-FrameworkBullet: The Functional PHP Micro-Framework
Bullet: The Functional PHP Micro-FrameworkVance Lucas
 
Workshop 18: CSS Animations & cool effects
Workshop 18: CSS Animations & cool effectsWorkshop 18: CSS Animations & cool effects
Workshop 18: CSS Animations & cool effectsVisual Engineering
 
BP-6 Repository Customization Best Practices
BP-6 Repository Customization Best PracticesBP-6 Repository Customization Best Practices
BP-6 Repository Customization Best PracticesAlfresco Software
 
How to Develop a Rich, Native-quality User Experience for Mobile Using Web St...
How to Develop a Rich, Native-quality User Experience for Mobile Using Web St...How to Develop a Rich, Native-quality User Experience for Mobile Using Web St...
How to Develop a Rich, Native-quality User Experience for Mobile Using Web St...David Kaneda
 
iPhone Web Applications: HTML5, CSS3 & dev tips for iPhone development
iPhone Web Applications: HTML5, CSS3 & dev tips for iPhone developmentiPhone Web Applications: HTML5, CSS3 & dev tips for iPhone development
iPhone Web Applications: HTML5, CSS3 & dev tips for iPhone developmentEstelle Weyl
 
Keypoints html5
Keypoints html5Keypoints html5
Keypoints html5dynamis
 
You too can be a bedwetting antfucker: Bruce Lawson, Opera, Fronteers 2011
You too can be a bedwetting antfucker: Bruce Lawson, Opera, Fronteers 2011You too can be a bedwetting antfucker: Bruce Lawson, Opera, Fronteers 2011
You too can be a bedwetting antfucker: Bruce Lawson, Opera, Fronteers 2011brucelawson
 
APIs, now and in the future
APIs, now and in the futureAPIs, now and in the future
APIs, now and in the futureChris Mills
 
Jacob Waller: Webifying Titanium Development
Jacob Waller: Webifying Titanium DevelopmentJacob Waller: Webifying Titanium Development
Jacob Waller: Webifying Titanium DevelopmentAxway Appcelerator
 
High Performance Ajax Applications
High Performance Ajax ApplicationsHigh Performance Ajax Applications
High Performance Ajax ApplicationsJulien Lecomte
 

What's hot (19)

Ruby MVC from scratch with Rack
Ruby MVC from scratch with RackRuby MVC from scratch with Rack
Ruby MVC from scratch with Rack
 
Progressive Enhancement 2.0 (jQuery Conference SF Bay Area 2011)
Progressive Enhancement 2.0 (jQuery Conference SF Bay Area 2011)Progressive Enhancement 2.0 (jQuery Conference SF Bay Area 2011)
Progressive Enhancement 2.0 (jQuery Conference SF Bay Area 2011)
 
Rails Girls: Programming, Web Applications and Ruby on Rails
Rails Girls: Programming, Web Applications and Ruby on RailsRails Girls: Programming, Web Applications and Ruby on Rails
Rails Girls: Programming, Web Applications and Ruby on Rails
 
Your own (little) gem: building an online business with Ruby
Your own (little) gem: building an online business with RubyYour own (little) gem: building an online business with Ruby
Your own (little) gem: building an online business with Ruby
 
jQuery UI and Plugins
jQuery UI and PluginsjQuery UI and Plugins
jQuery UI and Plugins
 
Building Mobile Applications with Ionic
Building Mobile Applications with IonicBuilding Mobile Applications with Ionic
Building Mobile Applications with Ionic
 
Realize mais com HTML 5 e CSS 3 - 16 EDTED - RJ
Realize mais com HTML 5 e CSS 3 - 16 EDTED - RJRealize mais com HTML 5 e CSS 3 - 16 EDTED - RJ
Realize mais com HTML 5 e CSS 3 - 16 EDTED - RJ
 
HTML5 JS APIs
HTML5 JS APIsHTML5 JS APIs
HTML5 JS APIs
 
Workshop 6: Designer tools
Workshop 6: Designer toolsWorkshop 6: Designer tools
Workshop 6: Designer tools
 
Bullet: The Functional PHP Micro-Framework
Bullet: The Functional PHP Micro-FrameworkBullet: The Functional PHP Micro-Framework
Bullet: The Functional PHP Micro-Framework
 
Workshop 18: CSS Animations & cool effects
Workshop 18: CSS Animations & cool effectsWorkshop 18: CSS Animations & cool effects
Workshop 18: CSS Animations & cool effects
 
BP-6 Repository Customization Best Practices
BP-6 Repository Customization Best PracticesBP-6 Repository Customization Best Practices
BP-6 Repository Customization Best Practices
 
How to Develop a Rich, Native-quality User Experience for Mobile Using Web St...
How to Develop a Rich, Native-quality User Experience for Mobile Using Web St...How to Develop a Rich, Native-quality User Experience for Mobile Using Web St...
How to Develop a Rich, Native-quality User Experience for Mobile Using Web St...
 
iPhone Web Applications: HTML5, CSS3 & dev tips for iPhone development
iPhone Web Applications: HTML5, CSS3 & dev tips for iPhone developmentiPhone Web Applications: HTML5, CSS3 & dev tips for iPhone development
iPhone Web Applications: HTML5, CSS3 & dev tips for iPhone development
 
Keypoints html5
Keypoints html5Keypoints html5
Keypoints html5
 
You too can be a bedwetting antfucker: Bruce Lawson, Opera, Fronteers 2011
You too can be a bedwetting antfucker: Bruce Lawson, Opera, Fronteers 2011You too can be a bedwetting antfucker: Bruce Lawson, Opera, Fronteers 2011
You too can be a bedwetting antfucker: Bruce Lawson, Opera, Fronteers 2011
 
APIs, now and in the future
APIs, now and in the futureAPIs, now and in the future
APIs, now and in the future
 
Jacob Waller: Webifying Titanium Development
Jacob Waller: Webifying Titanium DevelopmentJacob Waller: Webifying Titanium Development
Jacob Waller: Webifying Titanium Development
 
High Performance Ajax Applications
High Performance Ajax ApplicationsHigh Performance Ajax Applications
High Performance Ajax Applications
 

Viewers also liked

Technology independent UI development with JVx
Technology independent UI development with JVxTechnology independent UI development with JVx
Technology independent UI development with JVxSIB Visions GmbH
 
Unic - frontend development-in-complex-projects
Unic - frontend development-in-complex-projectsUnic - frontend development-in-complex-projects
Unic - frontend development-in-complex-projectsUnic
 
Frontend-Entwicklung mit SASS & Compass
Frontend-Entwicklung mit SASS & CompassFrontend-Entwicklung mit SASS & Compass
Frontend-Entwicklung mit SASS & CompassAndreas Dantz
 
Agile IT: Modern Architecture for Rapid Mobile App Development
Agile IT: Modern Architecture for Rapid Mobile App DevelopmentAgile IT: Modern Architecture for Rapid Mobile App Development
Agile IT: Modern Architecture for Rapid Mobile App DevelopmentAnyPresence
 
Basics of Rich Internet Applications
Basics of Rich Internet ApplicationsBasics of Rich Internet Applications
Basics of Rich Internet ApplicationsSubramanyan Murali
 
Comparison of Java Web Application Frameworks
Comparison of Java Web Application FrameworksComparison of Java Web Application Frameworks
Comparison of Java Web Application FrameworksAngelin R
 
Rethink Frontend Development With Elm
Rethink Frontend Development With ElmRethink Frontend Development With Elm
Rethink Frontend Development With ElmBrian Hogan
 
Modern Rapid Application Development - Too good to be true
Modern Rapid Application Development - Too good to be trueModern Rapid Application Development - Too good to be true
Modern Rapid Application Development - Too good to be trueWaveMaker, Inc.
 
Cost Effective Web Development Techniques
Cost Effective Web Development TechniquesCost Effective Web Development Techniques
Cost Effective Web Development TechniquesDrew McLellan
 
Fundamentals of Web Development For Non-Developers
Fundamentals of Web Development For Non-DevelopersFundamentals of Web Development For Non-Developers
Fundamentals of Web Development For Non-DevelopersLemi Orhan Ergin
 
Architecture of a Modern Web App
Architecture of a Modern Web AppArchitecture of a Modern Web App
Architecture of a Modern Web Appscothis
 

Viewers also liked (11)

Technology independent UI development with JVx
Technology independent UI development with JVxTechnology independent UI development with JVx
Technology independent UI development with JVx
 
Unic - frontend development-in-complex-projects
Unic - frontend development-in-complex-projectsUnic - frontend development-in-complex-projects
Unic - frontend development-in-complex-projects
 
Frontend-Entwicklung mit SASS & Compass
Frontend-Entwicklung mit SASS & CompassFrontend-Entwicklung mit SASS & Compass
Frontend-Entwicklung mit SASS & Compass
 
Agile IT: Modern Architecture for Rapid Mobile App Development
Agile IT: Modern Architecture for Rapid Mobile App DevelopmentAgile IT: Modern Architecture for Rapid Mobile App Development
Agile IT: Modern Architecture for Rapid Mobile App Development
 
Basics of Rich Internet Applications
Basics of Rich Internet ApplicationsBasics of Rich Internet Applications
Basics of Rich Internet Applications
 
Comparison of Java Web Application Frameworks
Comparison of Java Web Application FrameworksComparison of Java Web Application Frameworks
Comparison of Java Web Application Frameworks
 
Rethink Frontend Development With Elm
Rethink Frontend Development With ElmRethink Frontend Development With Elm
Rethink Frontend Development With Elm
 
Modern Rapid Application Development - Too good to be true
Modern Rapid Application Development - Too good to be trueModern Rapid Application Development - Too good to be true
Modern Rapid Application Development - Too good to be true
 
Cost Effective Web Development Techniques
Cost Effective Web Development TechniquesCost Effective Web Development Techniques
Cost Effective Web Development Techniques
 
Fundamentals of Web Development For Non-Developers
Fundamentals of Web Development For Non-DevelopersFundamentals of Web Development For Non-Developers
Fundamentals of Web Development For Non-Developers
 
Architecture of a Modern Web App
Architecture of a Modern Web AppArchitecture of a Modern Web App
Architecture of a Modern Web App
 

Similar to Web Frontend development: tools and good practices to (re)organize the chaos

Rapid Prototyping
Rapid PrototypingRapid Prototyping
Rapid PrototypingEven Wu
 
Web Development for UX Designers
Web Development for UX DesignersWeb Development for UX Designers
Web Development for UX DesignersAshlimarie
 
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
 
Keeping the frontend under control with Symfony and Webpack
Keeping the frontend under control with Symfony and WebpackKeeping the frontend under control with Symfony and Webpack
Keeping the frontend under control with Symfony and WebpackIgnacio Martín
 
Rails 3.1 Asset Pipeline
Rails 3.1 Asset PipelineRails 3.1 Asset Pipeline
Rails 3.1 Asset Pipelineeallam
 
Web Apps and more
Web Apps and moreWeb Apps and more
Web Apps and moreYan Shi
 
Web app and more
Web app and moreWeb app and more
Web app and morefaming su
 
20130528 solution linux_frousseau_nopain_webdev
20130528 solution linux_frousseau_nopain_webdev20130528 solution linux_frousseau_nopain_webdev
20130528 solution linux_frousseau_nopain_webdevFrank Rousseau
 
Using Ember to Make a Bazillion Dollars
Using Ember to Make a Bazillion DollarsUsing Ember to Make a Bazillion Dollars
Using Ember to Make a Bazillion DollarsMike Pack
 
Sass & Compass (Barcamp Stuttgart 2012)
Sass & Compass (Barcamp Stuttgart 2012)Sass & Compass (Barcamp Stuttgart 2012)
Sass & Compass (Barcamp Stuttgart 2012)emrox
 
Dan Persa, Maximilian Fellner - The recipe for scalable frontends - Codemotio...
Dan Persa, Maximilian Fellner - The recipe for scalable frontends - Codemotio...Dan Persa, Maximilian Fellner - The recipe for scalable frontends - Codemotio...
Dan Persa, Maximilian Fellner - The recipe for scalable frontends - Codemotio...Codemotion
 
Responsive Web Design e a Ubiquidade da Web
Responsive Web Design e a Ubiquidade da WebResponsive Web Design e a Ubiquidade da Web
Responsive Web Design e a Ubiquidade da WebEduardo Shiota Yasuda
 
HTML5 apps for iOS (and probably beyond)
HTML5 apps for iOS (and probably beyond)HTML5 apps for iOS (and probably beyond)
HTML5 apps for iOS (and probably beyond)Andi Farr
 
以Vue開發電子商務網站
架構與眉角
以Vue開發電子商務網站
架構與眉角以Vue開發電子商務網站
架構與眉角
以Vue開發電子商務網站
架構與眉角Mei-yu Chen
 
SPA, isomorphic and back to the server: our journey with JavaScript @ JsDay 2...
SPA, isomorphic and back to the server: our journey with JavaScript @ JsDay 2...SPA, isomorphic and back to the server: our journey with JavaScript @ JsDay 2...
SPA, isomorphic and back to the server: our journey with JavaScript @ JsDay 2...Alessandro Nadalin
 
Preprocessor presentation
Preprocessor presentationPreprocessor presentation
Preprocessor presentationMario Noble
 
Everything is Awesome - Cutting the Corners off the Web
Everything is Awesome - Cutting the Corners off the WebEverything is Awesome - Cutting the Corners off the Web
Everything is Awesome - Cutting the Corners off the WebJames Rakich
 

Similar to Web Frontend development: tools and good practices to (re)organize the chaos (20)

Death of a Themer
Death of a ThemerDeath of a Themer
Death of a Themer
 
Rapid Prototyping
Rapid PrototypingRapid Prototyping
Rapid Prototyping
 
Web Development for UX Designers
Web Development for UX DesignersWeb Development for UX Designers
Web Development for UX Designers
 
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}}
 
Keeping the frontend under control with Symfony and Webpack
Keeping the frontend under control with Symfony and WebpackKeeping the frontend under control with Symfony and Webpack
Keeping the frontend under control with Symfony and Webpack
 
Rails 3.1 Asset Pipeline
Rails 3.1 Asset PipelineRails 3.1 Asset Pipeline
Rails 3.1 Asset Pipeline
 
Accelerated Stylesheets
Accelerated StylesheetsAccelerated Stylesheets
Accelerated Stylesheets
 
Web Apps and more
Web Apps and moreWeb Apps and more
Web Apps and more
 
Web app and more
Web app and moreWeb app and more
Web app and more
 
20130528 solution linux_frousseau_nopain_webdev
20130528 solution linux_frousseau_nopain_webdev20130528 solution linux_frousseau_nopain_webdev
20130528 solution linux_frousseau_nopain_webdev
 
Using Ember to Make a Bazillion Dollars
Using Ember to Make a Bazillion DollarsUsing Ember to Make a Bazillion Dollars
Using Ember to Make a Bazillion Dollars
 
Sass & Compass (Barcamp Stuttgart 2012)
Sass & Compass (Barcamp Stuttgart 2012)Sass & Compass (Barcamp Stuttgart 2012)
Sass & Compass (Barcamp Stuttgart 2012)
 
Dan Persa, Maximilian Fellner - The recipe for scalable frontends - Codemotio...
Dan Persa, Maximilian Fellner - The recipe for scalable frontends - Codemotio...Dan Persa, Maximilian Fellner - The recipe for scalable frontends - Codemotio...
Dan Persa, Maximilian Fellner - The recipe for scalable frontends - Codemotio...
 
Nodejs.meetup
Nodejs.meetupNodejs.meetup
Nodejs.meetup
 
Responsive Web Design e a Ubiquidade da Web
Responsive Web Design e a Ubiquidade da WebResponsive Web Design e a Ubiquidade da Web
Responsive Web Design e a Ubiquidade da Web
 
HTML5 apps for iOS (and probably beyond)
HTML5 apps for iOS (and probably beyond)HTML5 apps for iOS (and probably beyond)
HTML5 apps for iOS (and probably beyond)
 
以Vue開發電子商務網站
架構與眉角
以Vue開發電子商務網站
架構與眉角以Vue開發電子商務網站
架構與眉角
以Vue開發電子商務網站
架構與眉角
 
SPA, isomorphic and back to the server: our journey with JavaScript @ JsDay 2...
SPA, isomorphic and back to the server: our journey with JavaScript @ JsDay 2...SPA, isomorphic and back to the server: our journey with JavaScript @ JsDay 2...
SPA, isomorphic and back to the server: our journey with JavaScript @ JsDay 2...
 
Preprocessor presentation
Preprocessor presentationPreprocessor presentation
Preprocessor presentation
 
Everything is Awesome - Cutting the Corners off the Web
Everything is Awesome - Cutting the Corners off the WebEverything is Awesome - Cutting the Corners off the Web
Everything is Awesome - Cutting the Corners off the Web
 

Recently uploaded

How To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.jsHow To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.jsAndolasoft Inc
 
How To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected WorkerHow To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected WorkerThousandEyes
 
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...ICS
 
why an Opensea Clone Script might be your perfect match.pdf
why an Opensea Clone Script might be your perfect match.pdfwhy an Opensea Clone Script might be your perfect match.pdf
why an Opensea Clone Script might be your perfect match.pdfjoe51371421
 
Optimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVOptimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVshikhaohhpro
 
A Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docxA Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docxComplianceQuest1
 
Test Automation Strategy for Frontend and Backend
Test Automation Strategy for Frontend and BackendTest Automation Strategy for Frontend and Backend
Test Automation Strategy for Frontend and BackendArshad QA
 
Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...OnePlan Solutions
 
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AISyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AIABDERRAOUF MEHENNI
 
HR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comHR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comFatema Valibhai
 
DNT_Corporate presentation know about us
DNT_Corporate presentation know about usDNT_Corporate presentation know about us
DNT_Corporate presentation know about usDynamic Netsoft
 
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfThe Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfkalichargn70th171
 
Diamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with PrecisionDiamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with PrecisionSolGuruz
 
Unlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language ModelsUnlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language Modelsaagamshah0812
 
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️Delhi Call girls
 
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsUnveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsAlberto González Trastoy
 
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...kellynguyen01
 

Recently uploaded (20)

How To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.jsHow To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.js
 
How To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected WorkerHow To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected Worker
 
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
 
why an Opensea Clone Script might be your perfect match.pdf
why an Opensea Clone Script might be your perfect match.pdfwhy an Opensea Clone Script might be your perfect match.pdf
why an Opensea Clone Script might be your perfect match.pdf
 
Optimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVOptimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTV
 
Microsoft AI Transformation Partner Playbook.pdf
Microsoft AI Transformation Partner Playbook.pdfMicrosoft AI Transformation Partner Playbook.pdf
Microsoft AI Transformation Partner Playbook.pdf
 
A Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docxA Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docx
 
Test Automation Strategy for Frontend and Backend
Test Automation Strategy for Frontend and BackendTest Automation Strategy for Frontend and Backend
Test Automation Strategy for Frontend and Backend
 
Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...
 
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AISyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
 
HR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comHR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.com
 
DNT_Corporate presentation know about us
DNT_Corporate presentation know about usDNT_Corporate presentation know about us
DNT_Corporate presentation know about us
 
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfThe Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
 
Exploring iOS App Development: Simplifying the Process
Exploring iOS App Development: Simplifying the ProcessExploring iOS App Development: Simplifying the Process
Exploring iOS App Development: Simplifying the Process
 
Diamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with PrecisionDiamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with Precision
 
Vip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS Live
Vip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS LiveVip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS Live
Vip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS Live
 
Unlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language ModelsUnlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language Models
 
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
 
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsUnveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
 
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
 

Web Frontend development: tools and good practices to (re)organize the chaos

  • 2. FRONTEND (re)organize the chaos Matteo Papadopoulos @spleenteo Stefano Verna @steffoz www.cantierecreativo.net
  • 3.
  • 5. Asset Pipeline “The new pipeline makes assets a first class citizen in the Rails stack.”
  • 6. Asset Pipeline gem 'jquery-rails' ! //= require 'jquery'
  • 9. Asset Pipeline Bower Frontend package manager
  • 11. Asset Pipeline $ npm install -g bower $ bower init
  • 12. Asset Pipeline $ cat bower.json { "name": "my-project", "dependencies": { "jquery-ui": "~1.11.1", "jquery": "~2.1.1" } }
  • 13. Asset Pipeline $ tree bower_components -L 1 ./bower_components "## jquery $## jquery-ui
  • 14. Asset Pipeline So we need two package managers?
  • 15. Asset Pipeline Rails Assets Frictionless proxy between Bundler and Bower
  • 16. Asset Pipeline source 'https://rubygems.org' source 'https://rails-assets.org' ! gem 'rails-assets-jquery-ui'
  • 17. Asset Pipeline Bundler Rails Assets Bower do you have rails-assets-jquery-ui? do you have jquery-ui? sure thing, take it! here's the gem!
  • 18. Asset Pipeline win-win that was easy.
  • 19. Asset Pipeline Compass “A SASS Framework”
  • 20. Compass Asset Pipeline vendor prefixes typography vertical rhythm grid reset helper functions image-related features
  • 21. Compass Asset Pipeline monolithic approach
  • 23. Asset Pipeline Compass php syndrome
  • 24. Compass Asset Pipeline box-shadow: 10px 10px 5px red;
  • 25. Compass Asset Pipeline box-shadow: 10px 10px 5px red; +box-shadow(red 10px 10px 5px)
  • 26. Compass Asset Pipeline vendor prefixes typography vertical rhythm grid reset helper functions image-related features
  • 27. Asset Pipeline Compass vendor prefixes image-related features
  • 28. Asset Pipeline Compass unix-like approach
  • 30. Asset Pipeline 100% Sass mixin library
  • 31. Asset Pipeline Autoprefixer CSS post-processor gem 'autoprefixer-rails'
  • 32. Asset Pipeline a { display: flex; } > 1% last 2 versions Firefox ESR Opera 12.1 a { display: -webkit-box; display: -webkit-flex; display: -moz-box; display: -ms-flexbox; display: flex }
  • 33. Asset Pipeline Compass vendor prefixes image-related features
  • 34. Asset Pipeline image-related features sprites webfont high DPI images support lossless image compression …
  • 35. Asset Pipeline task management tools
  • 36. Asset Pipeline GRUNT GULP BROCCOLI
  • 37. Asset Pipeline +3400 tasks mostly frontend-related
  • 38. Asset Pipeline $ npm install -g grunt-cli
  • 39. Asset Pipeline $ cat package.json { "name": "my-project", "dependencies": { "grunt": "~1.11.1", "grunt-bemo": "~2.1.1", ... } } $ npm install
  • 40. Asset Pipeline # Gruntfile.js ! module.exports = function(grunt) { grunt.loadNpmTasks('grunt-bemo'); ! grunt.initConfig({ bemo: { webfonts: { src: "app/assets/fonts/svg", fontDest: "app/assets/fonts", sassDest: "app/assets/stylesheets/_icon-glyphs.css.scss" }, sprites: { src: "app/assets/images/sprites", imageDest: "app/assets/images/sprites-{{density}}.png", sassDest: "app/assets/stylesheets/_sprites.css.scss" } } }); };
  • 41. Asset Pipeline $ grunt bemo ! Running "bemo-sprites" task ... ! Running "bemo-webfonts" task ...
  • 42. Asset Pipeline JS/Coffee code linter JS/Coffee code style checker Live reload SVG/PNG/JPG optimizer Inline assets Unused CSS removal ...
  • 43. Asset Pipeline Recap Use Bower packages, not gems Rails Assets Replace Compass Bourbon/Autoprefixer Grunt/Gulp/Broccoli
  • 45. Writing Sass Rails conventions $ rails generate controller books create app/controllers/books_controller.rb invoke erb create app/views/books invoke helper create app/helpers/books_helper.rb invoke assets invoke coffee create app/assets/javascripts/books.js.coffee invoke scss create app/assets/stylesheets/books.css.scss
  • 46. Writing Sass OOCSS Object-oriented CSS Organize the chaos v1 2012 - http://goo.gl/6ZRJm4
  • 47. OOCSS Writing Sass A CSS “object” is a repeating visual pattern, that can be abstracted into an independent snippet of HTML, CSS, and possibly JavaScript. That object can then be reused throughout a site.
  • 48.
  • 49.
  • 50.
  • 52.
  • 54. Writing Sass .media display: table width: 100% ! .media .img, .media .body display: table-cell vertical-align: top ! .media .img padding-right: 10px <div class="media"> ! <div class="img"> <img src="..." /> </div> ! <div class="body"> ... </div> ! </div>
  • 55. Writing Sass No margins, no positioning, 100% width .media display: table width: 100% ! .media .img, .media .body display: table-cell vertical-align: top ! .media .img padding-right: 10px
  • 56. Writing Sass Location indipendence Let the context choose your positioning Be fluid: always expand to take the full width of the container
  • 57. Writing Sass Just class selectors? .media display: table width: 100% ! .media .img, .media .body display: table-cell vertical-align: top ! .media .img padding-right: 10px
  • 58. Writing Sass ID selectors Limit reuse within the same page Tag selectors Force a semantic Carpet bombing
  • 59. Writing Sass .media display: table width: 100% ! .media .img, .media .body display: table-cell vertical-align: top ! .media .img padding-right: 10px Wait, what about descendent selectors?
  • 60. Writing Sass Descendent selectors Carpet bombing (again) Potential name clashing
  • 61. Writing Sass Descendent selectors Do not use them.
  • 62. Writing Sass .media display: table width: 100% ! .media .img, .media .body display: table-cell vertical-align: top ! .media__img padding-right: 10px
  • 63. Writing Sass .media display: table width: 100% ! .media__img, .media__body display: table-cell vertical-align: top ! .media__img padding-right: 10px
  • 64. Writing Sass BEM Block • Element • Modifier
  • 65. Writing Sass .media display: table width: 100% ! .media__img, .media__body display: table-cell vertical-align: top ! .media__img padding-right: 10px Block (CSS object) Block element
  • 66. Writing Sass .nav-bar Block (CSS object) .nav-bar__logo Block element
  • 67. Writing Sass .nav-bar Block (CSS object) .nav-bar__logo Block element .nav-bar--primary Modifier
  • 68. Writing Sass .media // .... ! .media--rev direction: rtl text-align: left ! .media__img padding-right: 0px padding-left: 10px <div class="media media--rev"> ! <div class="media__img"> <img src="..." /> </div> ! <div class="media__body"> ... </div> ! </div>
  • 70. Writing Sass But it's verbose and ugly and...! CSS has limited character set. Deal with it.
  • 71. Writing Sass Remember the pros! No more name clashing ! No more overrides ! Trivial to understand and maintain your codebase
  • 72.
  • 74. Writing Sass . "## application.css.sass "## _base.css.sass "## _font-faces.css.sass "## blocks % "## _button.css.sass % "## _media.css.sass % $## ... "## functions % $## ... "## mixins % $## ... $## variables $## ... Root file
  • 75. Writing Sass . "## application.css.sass "## _base.css.sass "## _font-faces.css.sass "## blocks % "## _button.css.sass % "## _media.css.sass % $## ... "## functions % $## ... "## mixins % $## ... $## variables $## ... // Silent code @import 'functions/**/*' @import 'variables/**/*' @import 'bourbon' @import 'mixins/**/*' ! // Font faces @import 'font-faces' ! // Base @import 'normalize-scss' @import 'base' ! // Blocks @import 'blocks/**/*'
  • 76. Writing Sass // Silent code @import 'functions/**/*' @import 'variables/**/*' @import 'bourbon' @import 'mixins/**/*' ! // Font faces @import 'font-faces' ! // Base @import 'normalize-scss' @import 'base' ! // Blocks @import 'blocks/**/*' gem "sass-globbing"
  • 77. Writing Sass . "## application.css.sass "## _base.css.sass "## _font-faces.css.sass "## blocks % "## _button.css.sass % "## _media.css.sass % $## ... "## functions % $## ... "## mixins % $## ... $## variables $## ... // Silent code @import 'functions/**/*' @import 'variables/**/*' @import 'bourbon' @import 'mixins/**/*' ! // Font faces @import 'font-faces' ! // Base @import 'normalize-scss' @import 'base' ! // Blocks @import 'blocks/**/*'
  • 78. . "## application.css.sass "## _base.css.sass "## _font-faces.css.sass "## blocks % "## _button.css.sass % "## _media.css.sass % $## ... "## functions % $## ... "## mixins % $## ... $## variables $## ... // Silent code @import 'functions/**/*' @import 'variables/**/*' @import 'bourbon' @import 'mixins/**/*' ! // Font faces @import 'font-faces' ! // Base @import 'normalize-scss' @import 'base' ! // Formats @import 'formats/**/*' ! // Blocks @import 'blocks/**/*' Writing Sass Configuration functions mixins
  • 79. // Silent code @import 'functions/**/*' @import 'variables/**/*' @import 'bourbon' @import 'mixins/**/*' ! // Font faces @import 'font-faces' ! // Base @import 'normalize-scss' @import 'base' ! // Formats @import 'formats/**/*' ! // Blocks @import 'blocks/**/*' Writing Sass . "## application.css.sass "## _base.css.sass "## _font-faces.css.sass "## blocks % "## _button.css.sass % "## _media.css.sass % $## ... "## functions % $## ... "## mixins % $## ... $## variables $## ... Default styling, Basefile
  • 80. Writing Sass html, body ! a ! ul, ol, blockquote ! li ! h1, h2, h3, h4, h5, h6, hgroup, ul, ol, dd, p, figure, pre, table, fieldset, hr, form ! input, textarea ! input[type="submit"], button
  • 81. // Silent code @import 'functions/**/*' @import 'variables/**/*' @import 'bourbon' @import 'mixins/**/*' ! // Font faces @import 'font-faces' ! // Base @import 'normalize-scss' @import 'base' ! // Blocks @import 'blocks/**/*' Writing Sass . "## application.css.sass "## _base.css.sass "## _font-faces.css.sass "## blocks % "## _button.css.sass % "## _media.css.sass % $## ... "## functions % $## ... "## mixins % $## ... $## variables $## ... 99% of the code is here!
  • 82. Writing Sass one block per file group blocks into subdirectories
  • 83. Asset Pipeline Recap Rails per-controller modularity is not scalable OCCSS is a better solution BEM How to structure our Rails stylesheets directory
  • 85. Asset Pipeline Bemo http://github.com/stefanoverna/bemo Project starter/Scaffolder Common BEM blocks library Grunt tasks for retina-ready sprites and web fonts
  • 86. THANKS! question time Matteo Papadopoulos @spleenteo Stefano Verna @steffoz