SlideShare a Scribd company logo
1 of 40
Download to read offline
Scalable front-end architecture
with Bootstrap 3 + Atomic CSS
Let’s do some intros
I’m dying to meet you, kindred spirits :)
Hayden Bleasel
Product Designer, Full-Stack
Developer, Entrepreneur.
Head of Product at Spaceship.
@haydenbleasel on the internet.
Nice to meet you.
Quick Question
How many of you know what Bootstrap is?
Quick Question
How many of you know what Atomic CSS is?
The Front-End
• Web development on the client’s side. Everything
the user sees, clicks, smiles at or gets aggravated
by. Kinda extremely important when making a site.
• Used to just refer to HTML, CSS and a little bit of JS
but since the Javascript Uprising™ it can also refer
to building the entirety of your website (database
infrastructure and everything) on the user’s
computer.
• But that’s for a whole other discussion…
What is Bootstrap and why do I care?
Kind of a big question and a bit of a history lesson.
So what is Bootstrap?
• Bootstrap was a hack-week project between two homies at Twitter
that spawned a community of 9 maintainers and 839 contributors.
• It was the idea that we could create a “skeleton framework” that
every website on the web used. They’re on 3.4% right now
(approximately 12,773,795 websites).
• It’s the most starred repo on Github.
• 15,801 commits, 49,318 forks, 107,745 stars.
• Pretty impressive for a slab of CSS and JS.
• Bootstrap 4 is in alpha now.
WTF is Bootstrap tho?
• It’s around 10,000 lines of CSS and JavaScript that you can
include in your website with two lines of code.
• You copy markup (HTML) from their documentation and it
renders some pretty boilerplate elements.
• It styles elements like forms, buttons and tables.
• It adds CSS components like navbars, badges, labels and
button groups.
• It adds JS components like tooltips, modals, dropdowns
and popovers.
What does Bootstrap contain?
• Default styling for HTML elements
• A whole heap of CSS & JS components
• A flexible 12-column grid system
• Bugs, occasionally
Installing is pretty easy…
# Install with BootstrapCDN:
https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css

https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js
# Install with Bower:
bower install bootstrap —save
# Install with NPM:
npm install bootstrap —save
# Install with NPM:
yarn add bootstrap
# Or just download the files from the website like a pleb
Markup is also pretty easy…
<button type=“button" class=“btn btn-default”>
This is a button
</button>
… sometimes
<nav class="navbar navbar-default">
<div class="container-fluid">
<div class="navbar-header">
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1" aria-expanded="false">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="#">Brand</a>
</div>
<div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
<ul class="nav navbar-nav">
<li class="active"><a href="#">Link <span class="sr-only">(current)</span></a></li>
<li><a href="#">Link</a></li>
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">Dropdown <span class="caret"></span></a>
<ul class="dropdown-menu">
<li><a href="#">Action</a></li>
<li><a href="#">Another action</a></li>
<li><a href="#">Something else here</a></li>
<li role="separator" class="divider"></li>
<li><a href="#">Separated link</a></li>
<li role="separator" class="divider"></li>
<li><a href="#">One more separated link</a></li>
</ul>
</li>
The point is, it’d be a lot
more work to build these
things from scratch.
Just because you’re using
Bootstrap, doesn’t mean it
has to look like Twitter.
The CSS overwrites are purely up to you. Bootstrap is
meant as a boilerplate, not a solution.
Why do we use Bootstrap?
• Startups use Bootstrap to build their entire MVP.
• Small companies build on Bootstrap to create an
intuitive user experience with backbone.
• Big companies use it because their dev team sucks
and they don’t understand how to build custom
interfaces at scale.
• We’re currently moving off it at Spaceship.
I thought you said it was good!
• It is good. It’s good for you, for startups, for MVPs.
• When you scale though, you need to focus on things
like performance, minification, product design etc.
• Only using 500 of the 10,000 lines of Bootstrap in
your production app isn’t efficient.
• Many growing startups like Spaceship have to move
off Bootstrap eventually. It’s like a kickstarter.
Are there any alternatives?
• There’s Foundation by Zurb. 25,000 stars, probably
the biggest Bootstrap rival.
• http://foundation.zurb.com/
• There’s also Bulma. It’s designed to rival Bootstrap
4, simpler but less thought-out. Based on flexbox
which is great.
• http://bulma.io/
That’s enough about Bootstrap
In lieu of a good segue to “how to write good CSS”. Don’t
worry, I’ll show the connection when we get near the end.
How should I write my CSS?
• This is a huge discussion that’s still going on the internet.
• The TL;DR is that we need a way to write stylesheets
that are incredibly modular like Bootstrap, where you
can take any component and smash it together with
another and it’ll look good.
• Easier said than done - you have to take every use case
into account AND THEN THERE’S IE and this is what
being a real front-end developer is all about — dealing
with other people’s shit code.
Atomic CSS
• The idea that we should write components that
“grow in size”. Atomic refers to a series of sizes:
atoms, molecules, organisms, etc.
• Aggregated atoms create molecules, aggregated
molecules create organisms, etc.
• This is much easier to explain with images TBH:
Atomic CSS: Atoms
Buttons and inputs. Can’t get much easier than this.
Button Button Button Button Button
Button
Button
Button
Button
Button
Button
Button
Button
Button
Button
Button
Button
Button
Button
Button
Button
Button
Button
Button
Johny Boo
Johny Boo
Johny Boo
Full name
Remember me
Atomic CSS: Molecules
We can combine these things to make a form.
Login
Email
Password
Control Panel
Remember me
Atomic CSS: Organisms
We can combine forms to
create a Settings Page.
Business Contacts
+38 (066) 875 67 97
Phone
ok
alex.robby
Skype
ok
seo@apple.com
Business email
To Moderate
2 fields selected Mark as OK Mark as Violation Mark all as OK
Experience
Select fields to update status
Senior Engineer
Position
ok
Tesla Motors
Company
ok
October
Working from
ok2011 December
Working to Current time
2012
The project folder
my_project_folder/
— styles/
— scripts/
— index.html
— favicon.ico
The styles folder
my_project_folder/styles/
— atoms
— molecules
— organisms
The styles/atoms folder
my_project_folder/styles/atoms
— button.css
— input.css
— table.css
— typography.css
The styles/molecules folder
my_project_folder/styles/molecules
— navbar.css
— badge.css
— label.css
— alert.css
The styles/organisms folder
my_project_folder/styles/organisms
— home.css
— about.css
— work.css
— contact.css
Bootstrap + Atomic CSS
• Everyone’s going to have their own opinion on how
to architect CSS. I find the Atomic structure works
for me from a speed and scalability perspective.
• Now let’s start overwriting Boostrap using the
“atomic-overwrite method”. Basically just set up
files that reflect Bootstrap’s different components
and build on it.
• Let’s see what it might look like…
Bootstrap Buttons
project/styles/atoms/button.css
/* Base */
.button { … }
/* Variations */
.button.default { … }

.button.primary { … }

.button.error { … }
/* States */
.button:hover { … }

.button:focus { … }
Bootstrap Inputs
project/styles/atoms/input.css
/* Base */
input.form-control { … }
/* Modifiers */
input.form-control[required] { … }

input.form-control[name=“email”] { … }

input.form-control[type=“password”] { … }

input.form-control[disabled] { … }

input.form-control:valid { … }
You should use LESS or Sass
• Don’t want to get into it in this talk, but you should
absolutely consider LESS when writing CSS
• It’s a preprocessor. You write fancy CSS (LESS) and
it converts it to CSS when you compile it.
• It will significantly cut down your code and make
writing modules and overwrites ridiculously easy.
• Here’s a quick example:
LESS / Sass vs CSS
/* CSS */
.button { … }
.button.default { … }

.button.primary { … }

.button.error { … }
.button:hover { … }

.button:focus { … }
/* LESS / Sass */
.button {

…

&.default { … }

&.primary { … }

&.error { … }

&:hover { … }

&:focus { … }

}
One last thing: Linting CSS
• My absolute favourite part of this topic on code quality.
Linters are absolutely amazing and indispensable. They
check your code as you’re writing it. They literally enforce
your style on everyone else.
• Some languages, like Javascript, have lots of linters to
choose from: JSLint, ESLint, JSHint, etc. All of these can be
configured, but the default options and extensibility varies.
• Get them on most text editors - Atom, Brackets, Sublime…
• For CSS, we can use CSSLint.
Realtime syntax checking
Some things to check out
• http://www.getbootstrap.com/
• http://bulma.io/
• http://patternlab.io/
• http://expo.getbootstrap.com/
• https://land-book.com/
• https://dribbble.com/
• https://github.com/JohnONolan/Styled
spaceship.com.au/launch
Interested in Spaceship?
Skip the waitlist:

More Related Content

What's hot

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
 
Untangling spring week2
Untangling spring week2Untangling spring week2
Untangling spring week2Derek Jacoby
 
Advanced Web Development
Advanced Web DevelopmentAdvanced Web Development
Advanced Web DevelopmentRobert J. Stein
 
Untangling spring week6
Untangling spring week6Untangling spring week6
Untangling spring week6Derek Jacoby
 
Untangling the web week 2 - SEO
Untangling the web week 2 - SEOUntangling the web week 2 - SEO
Untangling the web week 2 - SEODerek Jacoby
 
Behat - Drupal South 2018
Behat  - Drupal South 2018Behat  - Drupal South 2018
Behat - Drupal South 2018Berend de Boer
 
Ember Conf 2016: Building Mobile Apps with Ember
Ember Conf 2016: Building Mobile Apps with EmberEmber Conf 2016: Building Mobile Apps with Ember
Ember Conf 2016: Building Mobile Apps with EmberAlex Blom
 
Dreamweaver CS6, jQuery, PhoneGap, mobile design
Dreamweaver CS6, jQuery, PhoneGap, mobile designDreamweaver CS6, jQuery, PhoneGap, mobile design
Dreamweaver CS6, jQuery, PhoneGap, mobile designDee Sadler
 
Cutting the Fat
Cutting the FatCutting the Fat
Cutting the FatCodemotion
 
JSLink for ITPros - SharePoint Saturday Jersey
JSLink for ITPros - SharePoint Saturday JerseyJSLink for ITPros - SharePoint Saturday Jersey
JSLink for ITPros - SharePoint Saturday JerseyPaul Hunt
 
Introduction to html 5
Introduction to html 5Introduction to html 5
Introduction to html 5Nir Elbaz
 
Snappy Means Happy: Performance in Ember Apps
Snappy Means Happy: Performance in Ember AppsSnappy Means Happy: Performance in Ember Apps
Snappy Means Happy: Performance in Ember AppsMatthew Beale
 
Unobtrusive JavaScript
Unobtrusive JavaScriptUnobtrusive JavaScript
Unobtrusive JavaScriptdaveverwer
 
Phonegap Day 2016: Ember/JS & Hybrid Apps Tips
Phonegap Day 2016: Ember/JS & Hybrid Apps TipsPhonegap Day 2016: Ember/JS & Hybrid Apps Tips
Phonegap Day 2016: Ember/JS & Hybrid Apps TipsAlex Blom
 
Bootstrap and XPages (DanNotes 2013)
Bootstrap and XPages (DanNotes 2013)Bootstrap and XPages (DanNotes 2013)
Bootstrap and XPages (DanNotes 2013)Mark Leusink
 
Html5 Fit: Get Rid of Love Handles
Html5 Fit:  Get Rid of Love HandlesHtml5 Fit:  Get Rid of Love Handles
Html5 Fit: Get Rid of Love HandlesChris Love
 

What's hot (20)

Untangling7
Untangling7Untangling7
Untangling7
 
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
 
Untangling spring week2
Untangling spring week2Untangling spring week2
Untangling spring week2
 
Advanced Web Development
Advanced Web DevelopmentAdvanced Web Development
Advanced Web Development
 
Untangling spring week6
Untangling spring week6Untangling spring week6
Untangling spring week6
 
Untangling6
Untangling6Untangling6
Untangling6
 
Untangling the web week 2 - SEO
Untangling the web week 2 - SEOUntangling the web week 2 - SEO
Untangling the web week 2 - SEO
 
Behat - Drupal South 2018
Behat  - Drupal South 2018Behat  - Drupal South 2018
Behat - Drupal South 2018
 
Ember Conf 2016: Building Mobile Apps with Ember
Ember Conf 2016: Building Mobile Apps with EmberEmber Conf 2016: Building Mobile Apps with Ember
Ember Conf 2016: Building Mobile Apps with Ember
 
Dreamweaver CS6, jQuery, PhoneGap, mobile design
Dreamweaver CS6, jQuery, PhoneGap, mobile designDreamweaver CS6, jQuery, PhoneGap, mobile design
Dreamweaver CS6, jQuery, PhoneGap, mobile design
 
Cutting the Fat
Cutting the FatCutting the Fat
Cutting the Fat
 
Road to Rails
Road to RailsRoad to Rails
Road to Rails
 
JSLink for ITPros - SharePoint Saturday Jersey
JSLink for ITPros - SharePoint Saturday JerseyJSLink for ITPros - SharePoint Saturday Jersey
JSLink for ITPros - SharePoint Saturday Jersey
 
Introduction to html 5
Introduction to html 5Introduction to html 5
Introduction to html 5
 
Snappy Means Happy: Performance in Ember Apps
Snappy Means Happy: Performance in Ember AppsSnappy Means Happy: Performance in Ember Apps
Snappy Means Happy: Performance in Ember Apps
 
Unobtrusive JavaScript
Unobtrusive JavaScriptUnobtrusive JavaScript
Unobtrusive JavaScript
 
Phonegap Day 2016: Ember/JS & Hybrid Apps Tips
Phonegap Day 2016: Ember/JS & Hybrid Apps TipsPhonegap Day 2016: Ember/JS & Hybrid Apps Tips
Phonegap Day 2016: Ember/JS & Hybrid Apps Tips
 
Ember At Scale
Ember At ScaleEmber At Scale
Ember At Scale
 
Bootstrap and XPages (DanNotes 2013)
Bootstrap and XPages (DanNotes 2013)Bootstrap and XPages (DanNotes 2013)
Bootstrap and XPages (DanNotes 2013)
 
Html5 Fit: Get Rid of Love Handles
Html5 Fit:  Get Rid of Love HandlesHtml5 Fit:  Get Rid of Love Handles
Html5 Fit: Get Rid of Love Handles
 

Similar to Scalable front-end architecture with Bootstrap 3 + Atomic CSS

Intro To Twitter Bootstrap
Intro To Twitter BootstrapIntro To Twitter Bootstrap
Intro To Twitter BootstrapAhmed Haque
 
Code & Design Your First Website (Downtown Los Angeles)
Code & Design Your First Website (Downtown Los Angeles)Code & Design Your First Website (Downtown Los Angeles)
Code & Design Your First Website (Downtown Los Angeles)Thinkful
 
Know the reason behind choosing bootstrap as css framework
Know the reason behind choosing bootstrap as css frameworkKnow the reason behind choosing bootstrap as css framework
Know the reason behind choosing bootstrap as css frameworkOmkarsoft Bangalore
 
Bootstrap for Beginners
Bootstrap for BeginnersBootstrap for Beginners
Bootstrap for BeginnersD'arce Hess
 
Introduction to Bootstrap: Design for Developers
Introduction to Bootstrap: Design for DevelopersIntroduction to Bootstrap: Design for Developers
Introduction to Bootstrap: Design for DevelopersMelvin John
 
Teams, styles and scalable applications
Teams, styles and scalable applicationsTeams, styles and scalable applications
Teams, styles and scalable applicationsVittorio Vittori
 
Mobile Monday Presentation: Responsive Web Design
Mobile Monday Presentation: Responsive Web DesignMobile Monday Presentation: Responsive Web Design
Mobile Monday Presentation: Responsive Web DesignCantina
 
Introduction to BOOTSTRAP
Introduction to BOOTSTRAPIntroduction to BOOTSTRAP
Introduction to BOOTSTRAPJeanie Arnoco
 
Rapid and Responsive - UX to Prototype with Bootstrap
Rapid and Responsive - UX to Prototype with BootstrapRapid and Responsive - UX to Prototype with Bootstrap
Rapid and Responsive - UX to Prototype with BootstrapJosh Jeffryes
 
Twitter bootstrap training_session_ppt
Twitter bootstrap training_session_pptTwitter bootstrap training_session_ppt
Twitter bootstrap training_session_pptRadheshyam Kori
 
Html css crash course may 11th, atlanta
Html css crash course may 11th, atlantaHtml css crash course may 11th, atlanta
Html css crash course may 11th, atlantaThinkful
 
Responsive Web Design (April 18th, Los Angeles)
Responsive Web Design (April 18th, Los Angeles)Responsive Web Design (April 18th, Los Angeles)
Responsive Web Design (April 18th, Los Angeles)Thinkful
 
Code &amp; design your first website (3:16)
Code &amp; design your first website (3:16)Code &amp; design your first website (3:16)
Code &amp; design your first website (3:16)Thinkful
 
Exploring Our Front-End Workflows
Exploring Our Front-End WorkflowsExploring Our Front-End Workflows
Exploring Our Front-End Workflowsnolly00
 
AD105 - OneUI.. really? Is that because you don't know about Twitter Bootstrap?
AD105 - OneUI.. really? Is that because you don't know about Twitter Bootstrap?AD105 - OneUI.. really? Is that because you don't know about Twitter Bootstrap?
AD105 - OneUI.. really? Is that because you don't know about Twitter Bootstrap?Andrew Barickman
 
Intermediate Web Design.doc
Intermediate Web Design.docIntermediate Web Design.doc
Intermediate Web Design.docbutest
 
Intermediate Web Design.doc
Intermediate Web Design.docIntermediate Web Design.doc
Intermediate Web Design.docbutest
 
Architecting with Style
Architecting with StyleArchitecting with Style
Architecting with StyleTimothy Knight
 

Similar to Scalable front-end architecture with Bootstrap 3 + Atomic CSS (20)

Intro To Twitter Bootstrap
Intro To Twitter BootstrapIntro To Twitter Bootstrap
Intro To Twitter Bootstrap
 
Code & Design Your First Website (Downtown Los Angeles)
Code & Design Your First Website (Downtown Los Angeles)Code & Design Your First Website (Downtown Los Angeles)
Code & Design Your First Website (Downtown Los Angeles)
 
Know the reason behind choosing bootstrap as css framework
Know the reason behind choosing bootstrap as css frameworkKnow the reason behind choosing bootstrap as css framework
Know the reason behind choosing bootstrap as css framework
 
Bootstrap for Beginners
Bootstrap for BeginnersBootstrap for Beginners
Bootstrap for Beginners
 
Introduction to Bootstrap: Design for Developers
Introduction to Bootstrap: Design for DevelopersIntroduction to Bootstrap: Design for Developers
Introduction to Bootstrap: Design for Developers
 
Teams, styles and scalable applications
Teams, styles and scalable applicationsTeams, styles and scalable applications
Teams, styles and scalable applications
 
Mobile Monday Presentation: Responsive Web Design
Mobile Monday Presentation: Responsive Web DesignMobile Monday Presentation: Responsive Web Design
Mobile Monday Presentation: Responsive Web Design
 
Introduction to BOOTSTRAP
Introduction to BOOTSTRAPIntroduction to BOOTSTRAP
Introduction to BOOTSTRAP
 
Rapid and Responsive - UX to Prototype with Bootstrap
Rapid and Responsive - UX to Prototype with BootstrapRapid and Responsive - UX to Prototype with Bootstrap
Rapid and Responsive - UX to Prototype with Bootstrap
 
Twitter bootstrap training_session_ppt
Twitter bootstrap training_session_pptTwitter bootstrap training_session_ppt
Twitter bootstrap training_session_ppt
 
Html css crash course may 11th, atlanta
Html css crash course may 11th, atlantaHtml css crash course may 11th, atlanta
Html css crash course may 11th, atlanta
 
Responsive Web Design (April 18th, Los Angeles)
Responsive Web Design (April 18th, Los Angeles)Responsive Web Design (April 18th, Los Angeles)
Responsive Web Design (April 18th, Los Angeles)
 
Code &amp; design your first website (3:16)
Code &amp; design your first website (3:16)Code &amp; design your first website (3:16)
Code &amp; design your first website (3:16)
 
Exploring Our Front-End Workflows
Exploring Our Front-End WorkflowsExploring Our Front-End Workflows
Exploring Our Front-End Workflows
 
AD105 - OneUI.. really? Is that because you don't know about Twitter Bootstrap?
AD105 - OneUI.. really? Is that because you don't know about Twitter Bootstrap?AD105 - OneUI.. really? Is that because you don't know about Twitter Bootstrap?
AD105 - OneUI.. really? Is that because you don't know about Twitter Bootstrap?
 
Intermediate Web Design.doc
Intermediate Web Design.docIntermediate Web Design.doc
Intermediate Web Design.doc
 
Intermediate Web Design.doc
Intermediate Web Design.docIntermediate Web Design.doc
Intermediate Web Design.doc
 
Architecting with Style
Architecting with StyleArchitecting with Style
Architecting with Style
 
Bootstrap [part 1]
Bootstrap [part 1]Bootstrap [part 1]
Bootstrap [part 1]
 
Using a CSS Framework
Using a CSS FrameworkUsing a CSS Framework
Using a CSS Framework
 

Recently uploaded

CCS355 Neural Networks & Deep Learning Unit 1 PDF notes with Question bank .pdf
CCS355 Neural Networks & Deep Learning Unit 1 PDF notes with Question bank .pdfCCS355 Neural Networks & Deep Learning Unit 1 PDF notes with Question bank .pdf
CCS355 Neural Networks & Deep Learning Unit 1 PDF notes with Question bank .pdfAsst.prof M.Gokilavani
 
11. Properties of Liquid Fuels in Energy Engineering.pdf
11. Properties of Liquid Fuels in Energy Engineering.pdf11. Properties of Liquid Fuels in Energy Engineering.pdf
11. Properties of Liquid Fuels in Energy Engineering.pdfHafizMudaserAhmad
 
THE SENDAI FRAMEWORK FOR DISASTER RISK REDUCTION
THE SENDAI FRAMEWORK FOR DISASTER RISK REDUCTIONTHE SENDAI FRAMEWORK FOR DISASTER RISK REDUCTION
THE SENDAI FRAMEWORK FOR DISASTER RISK REDUCTIONjhunlian
 
Comprehensive energy systems.pdf Comprehensive energy systems.pdf
Comprehensive energy systems.pdf Comprehensive energy systems.pdfComprehensive energy systems.pdf Comprehensive energy systems.pdf
Comprehensive energy systems.pdf Comprehensive energy systems.pdfalene1
 
Immutable Image-Based Operating Systems - EW2024.pdf
Immutable Image-Based Operating Systems - EW2024.pdfImmutable Image-Based Operating Systems - EW2024.pdf
Immutable Image-Based Operating Systems - EW2024.pdfDrew Moseley
 
Main Memory Management in Operating System
Main Memory Management in Operating SystemMain Memory Management in Operating System
Main Memory Management in Operating SystemRashmi Bhat
 
Gravity concentration_MI20612MI_________
Gravity concentration_MI20612MI_________Gravity concentration_MI20612MI_________
Gravity concentration_MI20612MI_________Romil Mishra
 
chpater16.pptxMMMMMMMMMMMMMMMMMMMMMMMMMMM
chpater16.pptxMMMMMMMMMMMMMMMMMMMMMMMMMMMchpater16.pptxMMMMMMMMMMMMMMMMMMMMMMMMMMM
chpater16.pptxMMMMMMMMMMMMMMMMMMMMMMMMMMMNanaAgyeman13
 
Internship PPT ukai thermal power station .pptx
Internship PPT ukai thermal power station .pptxInternship PPT ukai thermal power station .pptx
Internship PPT ukai thermal power station .pptxmalikavita731
 
Robotics Group 10 (Control Schemes) cse.pdf
Robotics Group 10  (Control Schemes) cse.pdfRobotics Group 10  (Control Schemes) cse.pdf
Robotics Group 10 (Control Schemes) cse.pdfsahilsajad201
 
Katarzyna Lipka-Sidor - BIM School Course
Katarzyna Lipka-Sidor - BIM School CourseKatarzyna Lipka-Sidor - BIM School Course
Katarzyna Lipka-Sidor - BIM School Coursebim.edu.pl
 
Work Experience-Dalton Park.pptxfvvvvvvv
Work Experience-Dalton Park.pptxfvvvvvvvWork Experience-Dalton Park.pptxfvvvvvvv
Work Experience-Dalton Park.pptxfvvvvvvvLewisJB
 
Risk Management in Engineering Construction Project
Risk Management in Engineering Construction ProjectRisk Management in Engineering Construction Project
Risk Management in Engineering Construction ProjectErbil Polytechnic University
 
Class 1 | NFPA 72 | Overview Fire Alarm System
Class 1 | NFPA 72 | Overview Fire Alarm SystemClass 1 | NFPA 72 | Overview Fire Alarm System
Class 1 | NFPA 72 | Overview Fire Alarm Systemirfanmechengr
 
DEVICE DRIVERS AND INTERRUPTS SERVICE MECHANISM.pdf
DEVICE DRIVERS AND INTERRUPTS  SERVICE MECHANISM.pdfDEVICE DRIVERS AND INTERRUPTS  SERVICE MECHANISM.pdf
DEVICE DRIVERS AND INTERRUPTS SERVICE MECHANISM.pdfAkritiPradhan2
 
Input Output Management in Operating System
Input Output Management in Operating SystemInput Output Management in Operating System
Input Output Management in Operating SystemRashmi Bhat
 
National Level Hackathon Participation Certificate.pdf
National Level Hackathon Participation Certificate.pdfNational Level Hackathon Participation Certificate.pdf
National Level Hackathon Participation Certificate.pdfRajuKanojiya4
 
Module-1-(Building Acoustics) Noise Control (Unit-3). pdf
Module-1-(Building Acoustics) Noise Control (Unit-3). pdfModule-1-(Building Acoustics) Noise Control (Unit-3). pdf
Module-1-(Building Acoustics) Noise Control (Unit-3). pdfManish Kumar
 
Research Methodology for Engineering pdf
Research Methodology for Engineering pdfResearch Methodology for Engineering pdf
Research Methodology for Engineering pdfCaalaaAbdulkerim
 
TechTAC® CFD Report Summary: A Comparison of Two Types of Tubing Anchor Catchers
TechTAC® CFD Report Summary: A Comparison of Two Types of Tubing Anchor CatchersTechTAC® CFD Report Summary: A Comparison of Two Types of Tubing Anchor Catchers
TechTAC® CFD Report Summary: A Comparison of Two Types of Tubing Anchor Catcherssdickerson1
 

Recently uploaded (20)

CCS355 Neural Networks & Deep Learning Unit 1 PDF notes with Question bank .pdf
CCS355 Neural Networks & Deep Learning Unit 1 PDF notes with Question bank .pdfCCS355 Neural Networks & Deep Learning Unit 1 PDF notes with Question bank .pdf
CCS355 Neural Networks & Deep Learning Unit 1 PDF notes with Question bank .pdf
 
11. Properties of Liquid Fuels in Energy Engineering.pdf
11. Properties of Liquid Fuels in Energy Engineering.pdf11. Properties of Liquid Fuels in Energy Engineering.pdf
11. Properties of Liquid Fuels in Energy Engineering.pdf
 
THE SENDAI FRAMEWORK FOR DISASTER RISK REDUCTION
THE SENDAI FRAMEWORK FOR DISASTER RISK REDUCTIONTHE SENDAI FRAMEWORK FOR DISASTER RISK REDUCTION
THE SENDAI FRAMEWORK FOR DISASTER RISK REDUCTION
 
Comprehensive energy systems.pdf Comprehensive energy systems.pdf
Comprehensive energy systems.pdf Comprehensive energy systems.pdfComprehensive energy systems.pdf Comprehensive energy systems.pdf
Comprehensive energy systems.pdf Comprehensive energy systems.pdf
 
Immutable Image-Based Operating Systems - EW2024.pdf
Immutable Image-Based Operating Systems - EW2024.pdfImmutable Image-Based Operating Systems - EW2024.pdf
Immutable Image-Based Operating Systems - EW2024.pdf
 
Main Memory Management in Operating System
Main Memory Management in Operating SystemMain Memory Management in Operating System
Main Memory Management in Operating System
 
Gravity concentration_MI20612MI_________
Gravity concentration_MI20612MI_________Gravity concentration_MI20612MI_________
Gravity concentration_MI20612MI_________
 
chpater16.pptxMMMMMMMMMMMMMMMMMMMMMMMMMMM
chpater16.pptxMMMMMMMMMMMMMMMMMMMMMMMMMMMchpater16.pptxMMMMMMMMMMMMMMMMMMMMMMMMMMM
chpater16.pptxMMMMMMMMMMMMMMMMMMMMMMMMMMM
 
Internship PPT ukai thermal power station .pptx
Internship PPT ukai thermal power station .pptxInternship PPT ukai thermal power station .pptx
Internship PPT ukai thermal power station .pptx
 
Robotics Group 10 (Control Schemes) cse.pdf
Robotics Group 10  (Control Schemes) cse.pdfRobotics Group 10  (Control Schemes) cse.pdf
Robotics Group 10 (Control Schemes) cse.pdf
 
Katarzyna Lipka-Sidor - BIM School Course
Katarzyna Lipka-Sidor - BIM School CourseKatarzyna Lipka-Sidor - BIM School Course
Katarzyna Lipka-Sidor - BIM School Course
 
Work Experience-Dalton Park.pptxfvvvvvvv
Work Experience-Dalton Park.pptxfvvvvvvvWork Experience-Dalton Park.pptxfvvvvvvv
Work Experience-Dalton Park.pptxfvvvvvvv
 
Risk Management in Engineering Construction Project
Risk Management in Engineering Construction ProjectRisk Management in Engineering Construction Project
Risk Management in Engineering Construction Project
 
Class 1 | NFPA 72 | Overview Fire Alarm System
Class 1 | NFPA 72 | Overview Fire Alarm SystemClass 1 | NFPA 72 | Overview Fire Alarm System
Class 1 | NFPA 72 | Overview Fire Alarm System
 
DEVICE DRIVERS AND INTERRUPTS SERVICE MECHANISM.pdf
DEVICE DRIVERS AND INTERRUPTS  SERVICE MECHANISM.pdfDEVICE DRIVERS AND INTERRUPTS  SERVICE MECHANISM.pdf
DEVICE DRIVERS AND INTERRUPTS SERVICE MECHANISM.pdf
 
Input Output Management in Operating System
Input Output Management in Operating SystemInput Output Management in Operating System
Input Output Management in Operating System
 
National Level Hackathon Participation Certificate.pdf
National Level Hackathon Participation Certificate.pdfNational Level Hackathon Participation Certificate.pdf
National Level Hackathon Participation Certificate.pdf
 
Module-1-(Building Acoustics) Noise Control (Unit-3). pdf
Module-1-(Building Acoustics) Noise Control (Unit-3). pdfModule-1-(Building Acoustics) Noise Control (Unit-3). pdf
Module-1-(Building Acoustics) Noise Control (Unit-3). pdf
 
Research Methodology for Engineering pdf
Research Methodology for Engineering pdfResearch Methodology for Engineering pdf
Research Methodology for Engineering pdf
 
TechTAC® CFD Report Summary: A Comparison of Two Types of Tubing Anchor Catchers
TechTAC® CFD Report Summary: A Comparison of Two Types of Tubing Anchor CatchersTechTAC® CFD Report Summary: A Comparison of Two Types of Tubing Anchor Catchers
TechTAC® CFD Report Summary: A Comparison of Two Types of Tubing Anchor Catchers
 

Scalable front-end architecture with Bootstrap 3 + Atomic CSS

  • 1. Scalable front-end architecture with Bootstrap 3 + Atomic CSS
  • 2. Let’s do some intros I’m dying to meet you, kindred spirits :)
  • 3. Hayden Bleasel Product Designer, Full-Stack Developer, Entrepreneur. Head of Product at Spaceship. @haydenbleasel on the internet. Nice to meet you.
  • 4. Quick Question How many of you know what Bootstrap is?
  • 5. Quick Question How many of you know what Atomic CSS is?
  • 6. The Front-End • Web development on the client’s side. Everything the user sees, clicks, smiles at or gets aggravated by. Kinda extremely important when making a site. • Used to just refer to HTML, CSS and a little bit of JS but since the Javascript Uprising™ it can also refer to building the entirety of your website (database infrastructure and everything) on the user’s computer. • But that’s for a whole other discussion…
  • 7. What is Bootstrap and why do I care? Kind of a big question and a bit of a history lesson.
  • 8. So what is Bootstrap? • Bootstrap was a hack-week project between two homies at Twitter that spawned a community of 9 maintainers and 839 contributors. • It was the idea that we could create a “skeleton framework” that every website on the web used. They’re on 3.4% right now (approximately 12,773,795 websites). • It’s the most starred repo on Github. • 15,801 commits, 49,318 forks, 107,745 stars. • Pretty impressive for a slab of CSS and JS. • Bootstrap 4 is in alpha now.
  • 9. WTF is Bootstrap tho? • It’s around 10,000 lines of CSS and JavaScript that you can include in your website with two lines of code. • You copy markup (HTML) from their documentation and it renders some pretty boilerplate elements. • It styles elements like forms, buttons and tables. • It adds CSS components like navbars, badges, labels and button groups. • It adds JS components like tooltips, modals, dropdowns and popovers.
  • 10. What does Bootstrap contain? • Default styling for HTML elements • A whole heap of CSS & JS components • A flexible 12-column grid system • Bugs, occasionally
  • 11. Installing is pretty easy… # Install with BootstrapCDN: https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css
 https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js # Install with Bower: bower install bootstrap —save # Install with NPM: npm install bootstrap —save # Install with NPM: yarn add bootstrap # Or just download the files from the website like a pleb
  • 12. Markup is also pretty easy… <button type=“button" class=“btn btn-default”> This is a button </button>
  • 13. … sometimes <nav class="navbar navbar-default"> <div class="container-fluid"> <div class="navbar-header"> <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1" aria-expanded="false"> <span class="sr-only">Toggle navigation</span> <span class="icon-bar"></span> <span class="icon-bar"></span> <span class="icon-bar"></span> </button> <a class="navbar-brand" href="#">Brand</a> </div> <div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1"> <ul class="nav navbar-nav"> <li class="active"><a href="#">Link <span class="sr-only">(current)</span></a></li> <li><a href="#">Link</a></li> <li class="dropdown"> <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">Dropdown <span class="caret"></span></a> <ul class="dropdown-menu"> <li><a href="#">Action</a></li> <li><a href="#">Another action</a></li> <li><a href="#">Something else here</a></li> <li role="separator" class="divider"></li> <li><a href="#">Separated link</a></li> <li role="separator" class="divider"></li> <li><a href="#">One more separated link</a></li> </ul> </li>
  • 14. The point is, it’d be a lot more work to build these things from scratch.
  • 15. Just because you’re using Bootstrap, doesn’t mean it has to look like Twitter. The CSS overwrites are purely up to you. Bootstrap is meant as a boilerplate, not a solution.
  • 16. Why do we use Bootstrap? • Startups use Bootstrap to build their entire MVP. • Small companies build on Bootstrap to create an intuitive user experience with backbone. • Big companies use it because their dev team sucks and they don’t understand how to build custom interfaces at scale. • We’re currently moving off it at Spaceship.
  • 17. I thought you said it was good! • It is good. It’s good for you, for startups, for MVPs. • When you scale though, you need to focus on things like performance, minification, product design etc. • Only using 500 of the 10,000 lines of Bootstrap in your production app isn’t efficient. • Many growing startups like Spaceship have to move off Bootstrap eventually. It’s like a kickstarter.
  • 18. Are there any alternatives? • There’s Foundation by Zurb. 25,000 stars, probably the biggest Bootstrap rival. • http://foundation.zurb.com/ • There’s also Bulma. It’s designed to rival Bootstrap 4, simpler but less thought-out. Based on flexbox which is great. • http://bulma.io/
  • 19. That’s enough about Bootstrap In lieu of a good segue to “how to write good CSS”. Don’t worry, I’ll show the connection when we get near the end.
  • 20. How should I write my CSS? • This is a huge discussion that’s still going on the internet. • The TL;DR is that we need a way to write stylesheets that are incredibly modular like Bootstrap, where you can take any component and smash it together with another and it’ll look good. • Easier said than done - you have to take every use case into account AND THEN THERE’S IE and this is what being a real front-end developer is all about — dealing with other people’s shit code.
  • 21. Atomic CSS • The idea that we should write components that “grow in size”. Atomic refers to a series of sizes: atoms, molecules, organisms, etc. • Aggregated atoms create molecules, aggregated molecules create organisms, etc. • This is much easier to explain with images TBH:
  • 22. Atomic CSS: Atoms Buttons and inputs. Can’t get much easier than this. Button Button Button Button Button Button Button Button Button Button Button Button Button Button Button Button Button Button Button Button Button Button Button Button Johny Boo Johny Boo Johny Boo Full name Remember me
  • 23. Atomic CSS: Molecules We can combine these things to make a form. Login Email Password Control Panel Remember me
  • 24. Atomic CSS: Organisms We can combine forms to create a Settings Page. Business Contacts +38 (066) 875 67 97 Phone ok alex.robby Skype ok seo@apple.com Business email To Moderate 2 fields selected Mark as OK Mark as Violation Mark all as OK Experience Select fields to update status Senior Engineer Position ok Tesla Motors Company ok October Working from ok2011 December Working to Current time 2012
  • 25. The project folder my_project_folder/ — styles/ — scripts/ — index.html — favicon.ico
  • 26. The styles folder my_project_folder/styles/ — atoms — molecules — organisms
  • 27. The styles/atoms folder my_project_folder/styles/atoms — button.css — input.css — table.css — typography.css
  • 28. The styles/molecules folder my_project_folder/styles/molecules — navbar.css — badge.css — label.css — alert.css
  • 29. The styles/organisms folder my_project_folder/styles/organisms — home.css — about.css — work.css — contact.css
  • 30. Bootstrap + Atomic CSS • Everyone’s going to have their own opinion on how to architect CSS. I find the Atomic structure works for me from a speed and scalability perspective. • Now let’s start overwriting Boostrap using the “atomic-overwrite method”. Basically just set up files that reflect Bootstrap’s different components and build on it. • Let’s see what it might look like…
  • 32. project/styles/atoms/button.css /* Base */ .button { … } /* Variations */ .button.default { … }
 .button.primary { … }
 .button.error { … } /* States */ .button:hover { … }
 .button:focus { … }
  • 34. project/styles/atoms/input.css /* Base */ input.form-control { … } /* Modifiers */ input.form-control[required] { … }
 input.form-control[name=“email”] { … }
 input.form-control[type=“password”] { … }
 input.form-control[disabled] { … }
 input.form-control:valid { … }
  • 35. You should use LESS or Sass • Don’t want to get into it in this talk, but you should absolutely consider LESS when writing CSS • It’s a preprocessor. You write fancy CSS (LESS) and it converts it to CSS when you compile it. • It will significantly cut down your code and make writing modules and overwrites ridiculously easy. • Here’s a quick example:
  • 36. LESS / Sass vs CSS /* CSS */ .button { … } .button.default { … }
 .button.primary { … }
 .button.error { … } .button:hover { … }
 .button:focus { … } /* LESS / Sass */ .button {
 …
 &.default { … }
 &.primary { … }
 &.error { … }
 &:hover { … }
 &:focus { … }
 }
  • 37. One last thing: Linting CSS • My absolute favourite part of this topic on code quality. Linters are absolutely amazing and indispensable. They check your code as you’re writing it. They literally enforce your style on everyone else. • Some languages, like Javascript, have lots of linters to choose from: JSLint, ESLint, JSHint, etc. All of these can be configured, but the default options and extensibility varies. • Get them on most text editors - Atom, Brackets, Sublime… • For CSS, we can use CSSLint.
  • 39. Some things to check out • http://www.getbootstrap.com/ • http://bulma.io/ • http://patternlab.io/ • http://expo.getbootstrap.com/ • https://land-book.com/ • https://dribbble.com/ • https://github.com/JohnONolan/Styled