SlideShare a Scribd company logo
1 of 51
Download to read offline
@happynoff
Organize your assets
with Rails
@happynoff
Simon Courtois
www.tinci.fr
happynoff
simonc
@happynoff
My CSS is a mess!
@happynoff
Let's tidy up!
@happynoff
See your design as
components
@happynoff
@happynoff
@happynoff
@happynoff
@happynoff
@happynoff
@happynoff
Organizing
components
@happynoff
app/assets/stylesheets/
components/
_navbar.scss
_related-videos-item.scss
@happynoff
using sprockets*
*the Rails Asset Pipeline
@happynoff
= require_tree ./components
@happynoff
Conventions?
@happynoff
BEM?
SMACSS?
SUITCSS?
@happynoff
WIP CSS
@happynoff
Greatly inspired by Medium
https://gist.github.com/fat/a47b882eb5f84293c4ed
@happynoff
.componentName
.componentName-attributeName
.componentName--variantName
@happynoff
.is-open
.componentName.is-open
@happynoff
.u-depth1
@happynoff
.js-magicClick
@happynoff
Leverage SCSS
@happynoff
sprockets ▸ @import
@happynoff
@import 'components/avatar';
@import 'components/navbar';
@happynoff
Share variables and mixins
@happynoff
Colors
@happynoff
@import 'base/colors';
@happynoff
Which notation?
@happynoff
#RRGGBB
rgb(1, 2, 3)
rgba(1, 2, 3, 0.4)
hsl(1, 2%, 3%)
hsla(1, 2%, 3%, 0.4)
@happynoff
hsl: Hue Saturation
Lightness
@happynoff
hsl(200, 50%, 50%)
hsl(200, 50%, 70%)
hsl(200, 50%, 30%)
@happynoff
$color-green:
hsl(127, 58%, 45%);
$color-green--navbar:
hsl(127, 58%, 35%)
@happynoff
Typography
@happynoff
@import 'base/type';
@happynoff
Limit the font sizes
@happynoff
$fontSize-small: 14px;
$fontSize-medium: 16px;
$fontSize-large: 20px;
$fontSize-larger: 27px;
$fontSize-jumbo: 80px;
@happynoff
Typefaces may vary!
@happynoff
$fontSize-main-medium: 16px;
$fontSize-second-medium: 15px;
@happynoff
$fontWeight-normal: 400;
$fontWeight-bold: 700;
$fontWeight-extrabold: 900;
@happynoff
Mixins
@happynoff
@import 'base/mixins';
@happynoff
@mixin lg {
@media (min-width: 1170px) {
@content;
}
}
@happynoff
.magicBox {
font-size: $fontSize-medium;
@include lg {
font-size: $fontSize-large;
}
}
@happynoff
Bootstrap
@happynoff
@import
'base/bootstrap-override';
@happynoff
Find your
conventions!
@happynoff
Try - Fail - Do better
@happynoff
Questions?
@happynoff
Thank you!

More Related Content

Similar to Organize your assets with Rails

Lessons learnt from the FontShop site relaunch
Lessons learnt from the FontShop site relaunchLessons learnt from the FontShop site relaunch
Lessons learnt from the FontShop site relaunchSpiros Martzoukos
 
Html5 Brown Bag
Html5 Brown BagHtml5 Brown Bag
Html5 Brown Bagstuplum
 
Amped for AMP at Pubcon Las Vegas 2016
Amped for AMP at Pubcon Las Vegas 2016Amped for AMP at Pubcon Las Vegas 2016
Amped for AMP at Pubcon Las Vegas 2016Search Commander, Inc.
 
Web Frontend development: tools and good practices to (re)organize the chaos
Web Frontend development: tools and good practices to (re)organize the chaosWeb Frontend development: tools and good practices to (re)organize the chaos
Web Frontend development: tools and good practices to (re)organize the chaosMatteo Papadopoulos
 
Introduction to Ruby on Rails
Introduction to Ruby on RailsIntroduction to Ruby on Rails
Introduction to Ruby on RailsAlessandro DS
 
Node.js 기반 정적 페이지 블로그 엔진, 하루프레스
Node.js 기반 정적 페이지 블로그 엔진, 하루프레스Node.js 기반 정적 페이지 블로그 엔진, 하루프레스
Node.js 기반 정적 페이지 블로그 엔진, 하루프레스Rhio Kim
 
RailsConf 2018 - Webpacking for the Journey Ahead
RailsConf 2018 - Webpacking for the Journey AheadRailsConf 2018 - Webpacking for the Journey Ahead
RailsConf 2018 - Webpacking for the Journey AheadTaylor Jones
 
Master the New Core of Drupal 8 Now: with Symfony and Silex
Master the New Core of Drupal 8 Now: with Symfony and SilexMaster the New Core of Drupal 8 Now: with Symfony and Silex
Master the New Core of Drupal 8 Now: with Symfony and SilexRyan Weaver
 
Getting Started with Sass & Compass
Getting Started with Sass & CompassGetting Started with Sass & Compass
Getting Started with Sass & CompassRob Davarnia
 
OOScss Architecture For Rails Apps
OOScss Architecture For Rails AppsOOScss Architecture For Rails Apps
OOScss Architecture For Rails AppsNetguru
 
Vue 淺談前端建置工具
Vue 淺談前端建置工具Vue 淺談前端建置工具
Vue 淺談前端建置工具andyyou
 
Building for Accessibility
Building for AccessibilityBuilding for Accessibility
Building for AccessibilityNathan Hammond
 
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
 
Introduction to Drupal (7) Theming
Introduction to Drupal (7) ThemingIntroduction to Drupal (7) Theming
Introduction to Drupal (7) ThemingRobert Carr
 
Be happy with Ruby on Rails - CEUNSP Itu
Be happy with Ruby on Rails - CEUNSP ItuBe happy with Ruby on Rails - CEUNSP Itu
Be happy with Ruby on Rails - CEUNSP ItuLucas Renan
 
Introduction to CSS Preprocessors
Introduction to CSS PreprocessorsIntroduction to CSS Preprocessors
Introduction to CSS PreprocessorsBlake Newman
 

Similar to Organize your assets with Rails (20)

Lessons learnt from the FontShop site relaunch
Lessons learnt from the FontShop site relaunchLessons learnt from the FontShop site relaunch
Lessons learnt from the FontShop site relaunch
 
Html5 Brown Bag
Html5 Brown BagHtml5 Brown Bag
Html5 Brown Bag
 
Amped for AMP at Pubcon Las Vegas 2016
Amped for AMP at Pubcon Las Vegas 2016Amped for AMP at Pubcon Las Vegas 2016
Amped for AMP at Pubcon Las Vegas 2016
 
Web Frontend development: tools and good practices to (re)organize the chaos
Web Frontend development: tools and good practices to (re)organize the chaosWeb Frontend development: tools and good practices to (re)organize the chaos
Web Frontend development: tools and good practices to (re)organize the chaos
 
Designer toolkit
Designer toolkitDesigner toolkit
Designer toolkit
 
Introduction to Ruby on Rails
Introduction to Ruby on RailsIntroduction to Ruby on Rails
Introduction to Ruby on Rails
 
Node.js 기반 정적 페이지 블로그 엔진, 하루프레스
Node.js 기반 정적 페이지 블로그 엔진, 하루프레스Node.js 기반 정적 페이지 블로그 엔진, 하루프레스
Node.js 기반 정적 페이지 블로그 엔진, 하루프레스
 
RailsConf 2018 - Webpacking for the Journey Ahead
RailsConf 2018 - Webpacking for the Journey AheadRailsConf 2018 - Webpacking for the Journey Ahead
RailsConf 2018 - Webpacking for the Journey Ahead
 
Designer toolkit
Designer toolkitDesigner toolkit
Designer toolkit
 
Master the New Core of Drupal 8 Now: with Symfony and Silex
Master the New Core of Drupal 8 Now: with Symfony and SilexMaster the New Core of Drupal 8 Now: with Symfony and Silex
Master the New Core of Drupal 8 Now: with Symfony and Silex
 
Getting Started with Sass & Compass
Getting Started with Sass & CompassGetting Started with Sass & Compass
Getting Started with Sass & Compass
 
Wordpress(css,php,js,ajax)
Wordpress(css,php,js,ajax)Wordpress(css,php,js,ajax)
Wordpress(css,php,js,ajax)
 
OOScss Architecture For Rails Apps
OOScss Architecture For Rails AppsOOScss Architecture For Rails Apps
OOScss Architecture For Rails Apps
 
Vue 淺談前端建置工具
Vue 淺談前端建置工具Vue 淺談前端建置工具
Vue 淺談前端建置工具
 
Building for Accessibility
Building for AccessibilityBuilding for Accessibility
Building for Accessibility
 
Rails OO views
Rails OO viewsRails OO views
Rails OO views
 
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
 
Introduction to Drupal (7) Theming
Introduction to Drupal (7) ThemingIntroduction to Drupal (7) Theming
Introduction to Drupal (7) Theming
 
Be happy with Ruby on Rails - CEUNSP Itu
Be happy with Ruby on Rails - CEUNSP ItuBe happy with Ruby on Rails - CEUNSP Itu
Be happy with Ruby on Rails - CEUNSP Itu
 
Introduction to CSS Preprocessors
Introduction to CSS PreprocessorsIntroduction to CSS Preprocessors
Introduction to CSS Preprocessors
 

More from Simon Courtois

Conseils pour un lancement Product Hunt réussi
Conseils pour un lancement Product Hunt réussiConseils pour un lancement Product Hunt réussi
Conseils pour un lancement Product Hunt réussiSimon Courtois
 
How Unidecoder Transliterates UTF-8 to ASCII
How Unidecoder Transliterates UTF-8 to ASCIIHow Unidecoder Transliterates UTF-8 to ASCII
How Unidecoder Transliterates UTF-8 to ASCIISimon Courtois
 
Multi tenant/lang application with Ruby on Rails
Multi tenant/lang application with Ruby on RailsMulti tenant/lang application with Ruby on Rails
Multi tenant/lang application with Ruby on RailsSimon Courtois
 
Fake your files - MemFs
Fake your files - MemFsFake your files - MemFs
Fake your files - MemFsSimon Courtois
 
Rails is like Burger King
Rails is like Burger KingRails is like Burger King
Rails is like Burger KingSimon Courtois
 
Pourquoi Ruby on Rails ça déchire ?
Pourquoi Ruby on Rails ça déchire ?Pourquoi Ruby on Rails ça déchire ?
Pourquoi Ruby on Rails ça déchire ?Simon Courtois
 

More from Simon Courtois (11)

Conseils pour un lancement Product Hunt réussi
Conseils pour un lancement Product Hunt réussiConseils pour un lancement Product Hunt réussi
Conseils pour un lancement Product Hunt réussi
 
How Unidecoder Transliterates UTF-8 to ASCII
How Unidecoder Transliterates UTF-8 to ASCIIHow Unidecoder Transliterates UTF-8 to ASCII
How Unidecoder Transliterates UTF-8 to ASCII
 
Get Slim!
Get Slim!Get Slim!
Get Slim!
 
Multi tenant/lang application with Ruby on Rails
Multi tenant/lang application with Ruby on RailsMulti tenant/lang application with Ruby on Rails
Multi tenant/lang application with Ruby on Rails
 
Fake your files - MemFs
Fake your files - MemFsFake your files - MemFs
Fake your files - MemFs
 
Rails is like Burger King
Rails is like Burger KingRails is like Burger King
Rails is like Burger King
 
Ruby and DCI
Ruby and DCIRuby and DCI
Ruby and DCI
 
Cells
CellsCells
Cells
 
Ariane
ArianeAriane
Ariane
 
Pourquoi Ruby on Rails ça déchire ?
Pourquoi Ruby on Rails ça déchire ?Pourquoi Ruby on Rails ça déchire ?
Pourquoi Ruby on Rails ça déchire ?
 
Commander
CommanderCommander
Commander
 

Recently uploaded

Potential of AI (Generative AI) in Business: Learnings and Insights
Potential of AI (Generative AI) in Business: Learnings and InsightsPotential of AI (Generative AI) in Business: Learnings and Insights
Potential of AI (Generative AI) in Business: Learnings and InsightsRavi Sanghani
 
Connecting the Dots for Information Discovery.pdf
Connecting the Dots for Information Discovery.pdfConnecting the Dots for Information Discovery.pdf
Connecting the Dots for Information Discovery.pdfNeo4j
 
UiPath Community: Communication Mining from Zero to Hero
UiPath Community: Communication Mining from Zero to HeroUiPath Community: Communication Mining from Zero to Hero
UiPath Community: Communication Mining from Zero to HeroUiPathCommunity
 
Scale your database traffic with Read & Write split using MySQL Router
Scale your database traffic with Read & Write split using MySQL RouterScale your database traffic with Read & Write split using MySQL Router
Scale your database traffic with Read & Write split using MySQL RouterMydbops
 
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptxPasskey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptxLoriGlavin3
 
A Framework for Development in the AI Age
A Framework for Development in the AI AgeA Framework for Development in the AI Age
A Framework for Development in the AI AgeCprime
 
React Native vs Ionic - The Best Mobile App Framework
React Native vs Ionic - The Best Mobile App FrameworkReact Native vs Ionic - The Best Mobile App Framework
React Native vs Ionic - The Best Mobile App FrameworkPixlogix Infotech
 
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24Mark Goldstein
 
Glenn Lazarus- Why Your Observability Strategy Needs Security Observability
Glenn Lazarus- Why Your Observability Strategy Needs Security ObservabilityGlenn Lazarus- Why Your Observability Strategy Needs Security Observability
Glenn Lazarus- Why Your Observability Strategy Needs Security Observabilityitnewsafrica
 
MuleSoft Online Meetup Group - B2B Crash Course: Release SparkNotes
MuleSoft Online Meetup Group - B2B Crash Course: Release SparkNotesMuleSoft Online Meetup Group - B2B Crash Course: Release SparkNotes
MuleSoft Online Meetup Group - B2B Crash Course: Release SparkNotesManik S Magar
 
Microservices, Docker deploy and Microservices source code in C#
Microservices, Docker deploy and Microservices source code in C#Microservices, Docker deploy and Microservices source code in C#
Microservices, Docker deploy and Microservices source code in C#Karmanjay Verma
 
[Webinar] SpiraTest - Setting New Standards in Quality Assurance
[Webinar] SpiraTest - Setting New Standards in Quality Assurance[Webinar] SpiraTest - Setting New Standards in Quality Assurance
[Webinar] SpiraTest - Setting New Standards in Quality AssuranceInflectra
 
Genislab builds better products and faster go-to-market with Lean project man...
Genislab builds better products and faster go-to-market with Lean project man...Genislab builds better products and faster go-to-market with Lean project man...
Genislab builds better products and faster go-to-market with Lean project man...Farhan Tariq
 
A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxA Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxLoriGlavin3
 
Abdul Kader Baba- Managing Cybersecurity Risks and Compliance Requirements i...
Abdul Kader Baba- Managing Cybersecurity Risks  and Compliance Requirements i...Abdul Kader Baba- Managing Cybersecurity Risks  and Compliance Requirements i...
Abdul Kader Baba- Managing Cybersecurity Risks and Compliance Requirements i...itnewsafrica
 
Varsha Sewlal- Cyber Attacks on Critical Critical Infrastructure
Varsha Sewlal- Cyber Attacks on Critical Critical InfrastructureVarsha Sewlal- Cyber Attacks on Critical Critical Infrastructure
Varsha Sewlal- Cyber Attacks on Critical Critical Infrastructureitnewsafrica
 
A Glance At The Java Performance Toolbox
A Glance At The Java Performance ToolboxA Glance At The Java Performance Toolbox
A Glance At The Java Performance ToolboxAna-Maria Mihalceanu
 
Long journey of Ruby standard library at RubyConf AU 2024
Long journey of Ruby standard library at RubyConf AU 2024Long journey of Ruby standard library at RubyConf AU 2024
Long journey of Ruby standard library at RubyConf AU 2024Hiroshi SHIBATA
 
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...Alkin Tezuysal
 
Generative AI - Gitex v1Generative AI - Gitex v1.pptx
Generative AI - Gitex v1Generative AI - Gitex v1.pptxGenerative AI - Gitex v1Generative AI - Gitex v1.pptx
Generative AI - Gitex v1Generative AI - Gitex v1.pptxfnnc6jmgwh
 

Recently uploaded (20)

Potential of AI (Generative AI) in Business: Learnings and Insights
Potential of AI (Generative AI) in Business: Learnings and InsightsPotential of AI (Generative AI) in Business: Learnings and Insights
Potential of AI (Generative AI) in Business: Learnings and Insights
 
Connecting the Dots for Information Discovery.pdf
Connecting the Dots for Information Discovery.pdfConnecting the Dots for Information Discovery.pdf
Connecting the Dots for Information Discovery.pdf
 
UiPath Community: Communication Mining from Zero to Hero
UiPath Community: Communication Mining from Zero to HeroUiPath Community: Communication Mining from Zero to Hero
UiPath Community: Communication Mining from Zero to Hero
 
Scale your database traffic with Read & Write split using MySQL Router
Scale your database traffic with Read & Write split using MySQL RouterScale your database traffic with Read & Write split using MySQL Router
Scale your database traffic with Read & Write split using MySQL Router
 
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptxPasskey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptx
 
A Framework for Development in the AI Age
A Framework for Development in the AI AgeA Framework for Development in the AI Age
A Framework for Development in the AI Age
 
React Native vs Ionic - The Best Mobile App Framework
React Native vs Ionic - The Best Mobile App FrameworkReact Native vs Ionic - The Best Mobile App Framework
React Native vs Ionic - The Best Mobile App Framework
 
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24
 
Glenn Lazarus- Why Your Observability Strategy Needs Security Observability
Glenn Lazarus- Why Your Observability Strategy Needs Security ObservabilityGlenn Lazarus- Why Your Observability Strategy Needs Security Observability
Glenn Lazarus- Why Your Observability Strategy Needs Security Observability
 
MuleSoft Online Meetup Group - B2B Crash Course: Release SparkNotes
MuleSoft Online Meetup Group - B2B Crash Course: Release SparkNotesMuleSoft Online Meetup Group - B2B Crash Course: Release SparkNotes
MuleSoft Online Meetup Group - B2B Crash Course: Release SparkNotes
 
Microservices, Docker deploy and Microservices source code in C#
Microservices, Docker deploy and Microservices source code in C#Microservices, Docker deploy and Microservices source code in C#
Microservices, Docker deploy and Microservices source code in C#
 
[Webinar] SpiraTest - Setting New Standards in Quality Assurance
[Webinar] SpiraTest - Setting New Standards in Quality Assurance[Webinar] SpiraTest - Setting New Standards in Quality Assurance
[Webinar] SpiraTest - Setting New Standards in Quality Assurance
 
Genislab builds better products and faster go-to-market with Lean project man...
Genislab builds better products and faster go-to-market with Lean project man...Genislab builds better products and faster go-to-market with Lean project man...
Genislab builds better products and faster go-to-market with Lean project man...
 
A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxA Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
 
Abdul Kader Baba- Managing Cybersecurity Risks and Compliance Requirements i...
Abdul Kader Baba- Managing Cybersecurity Risks  and Compliance Requirements i...Abdul Kader Baba- Managing Cybersecurity Risks  and Compliance Requirements i...
Abdul Kader Baba- Managing Cybersecurity Risks and Compliance Requirements i...
 
Varsha Sewlal- Cyber Attacks on Critical Critical Infrastructure
Varsha Sewlal- Cyber Attacks on Critical Critical InfrastructureVarsha Sewlal- Cyber Attacks on Critical Critical Infrastructure
Varsha Sewlal- Cyber Attacks on Critical Critical Infrastructure
 
A Glance At The Java Performance Toolbox
A Glance At The Java Performance ToolboxA Glance At The Java Performance Toolbox
A Glance At The Java Performance Toolbox
 
Long journey of Ruby standard library at RubyConf AU 2024
Long journey of Ruby standard library at RubyConf AU 2024Long journey of Ruby standard library at RubyConf AU 2024
Long journey of Ruby standard library at RubyConf AU 2024
 
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...
 
Generative AI - Gitex v1Generative AI - Gitex v1.pptx
Generative AI - Gitex v1Generative AI - Gitex v1.pptxGenerative AI - Gitex v1Generative AI - Gitex v1.pptx
Generative AI - Gitex v1Generative AI - Gitex v1.pptx
 

Organize your assets with Rails