SlideShare a Scribd company logo
1 of 42
Download to read offline
smacssPREPARING DRUPAL 8 CSS ORGANIZATION.
SMACSS in Drupal 8 is not required or a standard.
However, it is a best-practice.
Implementing SMACSS in Drupal 8 is a work-in-progress.
A NOTE TO THE READER.
hey,listen
Follow along: https://www.drupal.org/node/1887922
A LITTLE ABOUT MYSELF.
ericsembrat
Web Manager at the College of Engineering at
Georgia Tech.
President of the Atlanta Drupal User’s Group.
Doctoral student at Georgia State University.
Learn more: http://www.webbeh.com
cssorganizationTHE NEVER-ENDING STRUGGLE FOR SANITY.
CONTROL-F ALL DAY.
disorganized
CSS best-practices in Drupal 7 didn’t exist beyond basic
CSS practices.
So, many of your theme frameworks have lots of different
confusing CSS organization.
Go back in time: https://www.drupal.org/node/302199
Our old friend Zen (3.x).
Or, our newer friend - Zen (5.x).
(how I feel when navigating all the different
CSS structures to find relevant styles)
there’saneasierwayLET’S BRING SOME BEST-PRACTICES IN FRONT-END INTO DRUPAL.
smacssAll about the smacks.
SMACSS (pronounced “smacks”) is more style guide than rigid framework.
There is no library within here for you to download or install. SMACSS is a
way to examine your design process and as a way to fit those rigid
frameworks into a flexible thought process. It is an attempt to document
a consistent approach to site development when using CSS.
Scalable (and) 

Modular 

Architecture (for)
CSS
Buy the book: https://smacss.com/
SMACSS follows object-oriented programming (OO) in that its goals are to:
Increase the semantic value of a section of html and content
Decrease the expectation of a specific html structure
More generally, SMACSS’ focus is on locating and organizing patterns
throughout your CSS so that it is reusable and easier to segment and
adjust.
SMACSS’ design is intended to be a starting point (not an end-all) to
building a style guide and CSS standard.
Organization is not rigidly defined.
A NOTE TO THE READER.
hey,listen
base
layout
module
state
theme
base
Base rules are applied directly to elements through element selectors,
descendent selectors, child selectors, pseudo-classes, however not specific
class or ID selectors.
(remember reset.css? this is where that goes)
layout
Layout rules apply directly to the sizes and locations of your major
template components (header, footer, sidebar, main area).
module
Minor page components include navigation bars and widgets. They tend to
be inside layout components and even within other modules.
Modules should be designed so they can exist on their own, which gives
them greater flexibility in being combined and moved around to different
parts of the design without breaking the layout. With modules we do want
to avoid IDs and element selectors. More reuse means classes.
state
A state is something that augments and overrides all other styles.
States are generally applied to the same element as a layout rule or
applied to the same element as a base module class.
theme
A theme defines colors and images that give your application or site its
look and feel.
Themes can affect any of the primary types. It could override base styles
like default link colors. It could change module elements such as chrome
colors and borders. It could affect layout with different arrangements. It
could also alter how states look.
base
layout
module
state
theme
base
layout
module
state
theme
base
layout
component
state
theme
drupal8themes?SMACSS + Drupal for themers.
css/
base/
{base file name}.css
layout/
{layout file name}.css
component/
{component file name}.css
theme/
{theme file name}.css
File structure for Drupal 8 theme CSS:
Always separate Base, Layout, and Component
styles into their own files.
Drupal will aggregate these separate files into one
file, so there is no performance problem with this
practice.)
For complex themes, consider placing each
component or component family in its own file.
State rules, including media queries, should be
included with the component to which they
apply.
drupal8modules?SMACSS + Drupal for coders.
module_name.module.css: This file should hold the minimal styles needed
to get the module's functionality working. (layout, component state styles).
module_name.theme.css: This file should hold extra styles to make the
module's functionality aesthetically pleasing. (theme styles).
module_name.admin.css: This file should hold the minimal styles needed
to get the module's admin screens working. (layout, component state
styles).
On admin screens, the module may choose to load the *.module.css in
addition to the *.admin.css file.
module_name.admin.theme.css: This file should hold extra styles to make
the module's admin screens aesthetically pleasing. (theme styles).
File structure for Drupal 8 theme CSS:
Note: Modules should never have any base styles.
Drupal core's modules do not have any base
styles. Instead Drupal core uses the Normalize.css
library augmented with a drupal.base.css library.
helpwithsmacss?CSS preprocessors to the rescue.
Sass (and contributed plugins) help to encourage
consistency through the usage of mixins,
variables, loops, and libraries.
Mixins
Variables
Loops / Logic
Libraries
Partial Files
libsass
sass-globbing
css3 library (compass,
bourbon)
plugins as needed
cssfiles
sassfiles
libsass
sass-globbing
css3 library (compass,
bourbon)
plugins as needed
cssfiles
sassfiles
your css (as sass files)
compiled css files
Sass-globbing?
base layout component theme
questions?

More Related Content

Similar to April 2016 - MiniCamp Atlanta - SMACSS - Preparing Drupal 8 CSS Organization

SageFrame Templating
SageFrame TemplatingSageFrame Templating
SageFrame TemplatingMarshalP
 
Structuring your CSS for maintainability: rules and guile lines to write CSS
Structuring your CSS for maintainability: rules and guile lines to write CSSStructuring your CSS for maintainability: rules and guile lines to write CSS
Structuring your CSS for maintainability: rules and guile lines to write CSSSanjoy Kr. Paul
 
Display Suite: A Themers Perspective
Display Suite: A Themers PerspectiveDisplay Suite: A Themers Perspective
Display Suite: A Themers PerspectiveMediacurrent
 
SCSS Implementation
SCSS ImplementationSCSS Implementation
SCSS ImplementationAmey Parab
 
7 Theming in Drupal
7 Theming in Drupal7 Theming in Drupal
7 Theming in DrupalWingston
 
Css training tutorial css3 & css4 essentials
Css training tutorial css3 & css4 essentialsCss training tutorial css3 & css4 essentials
Css training tutorial css3 & css4 essentialsQA TrainingHub
 
Compile your Style
Compile your StyleCompile your Style
Compile your StyleRagnar Kurm
 
We Need to Talk About CSS
We Need to Talk About CSSWe Need to Talk About CSS
We Need to Talk About CSSSean Durham
 
Sass:-Syntactically Awesome Stylesheet by Shafeeq
Sass:-Syntactically Awesome Stylesheet by ShafeeqSass:-Syntactically Awesome Stylesheet by Shafeeq
Sass:-Syntactically Awesome Stylesheet by ShafeeqDignitasDigital1
 
Efficiently theming a multi-site Drupal 8 portal - Drupal Dev Days Seville 2017
Efficiently theming a multi-site Drupal 8 portal - Drupal Dev Days Seville 2017Efficiently theming a multi-site Drupal 8 portal - Drupal Dev Days Seville 2017
Efficiently theming a multi-site Drupal 8 portal - Drupal Dev Days Seville 2017La Drupalera
 
Drupal Camp Manila 2014 - Theming with Zen
Drupal Camp Manila 2014 - Theming with ZenDrupal Camp Manila 2014 - Theming with Zen
Drupal Camp Manila 2014 - Theming with ZenJapo Domingo
 
Drupal 6 Overview
Drupal 6 OverviewDrupal 6 Overview
Drupal 6 OverviewRyan Cross
 
CSS Training in Bangalore
CSS Training in BangaloreCSS Training in Bangalore
CSS Training in Bangalorerajkamal560066
 
HTML and CSS Coding Standards
HTML and CSS Coding StandardsHTML and CSS Coding Standards
HTML and CSS Coding StandardsSaajan Maharjan
 

Similar to April 2016 - MiniCamp Atlanta - SMACSS - Preparing Drupal 8 CSS Organization (20)

PSD to Theme: The SMACSS Way
PSD to Theme: The SMACSS WayPSD to Theme: The SMACSS Way
PSD to Theme: The SMACSS Way
 
SageFrame Templating
SageFrame TemplatingSageFrame Templating
SageFrame Templating
 
Structuring your CSS for maintainability: rules and guile lines to write CSS
Structuring your CSS for maintainability: rules and guile lines to write CSSStructuring your CSS for maintainability: rules and guile lines to write CSS
Structuring your CSS for maintainability: rules and guile lines to write CSS
 
Drupal - Introduction to Drupal Creating Modules
Drupal - Introduction to Drupal Creating ModulesDrupal - Introduction to Drupal Creating Modules
Drupal - Introduction to Drupal Creating Modules
 
Themes
ThemesThemes
Themes
 
Display Suite: A Themers Perspective
Display Suite: A Themers PerspectiveDisplay Suite: A Themers Perspective
Display Suite: A Themers Perspective
 
SCSS Implementation
SCSS ImplementationSCSS Implementation
SCSS Implementation
 
7 Theming in Drupal
7 Theming in Drupal7 Theming in Drupal
7 Theming in Drupal
 
Css training tutorial css3 & css4 essentials
Css training tutorial css3 & css4 essentialsCss training tutorial css3 & css4 essentials
Css training tutorial css3 & css4 essentials
 
Compile your Style
Compile your StyleCompile your Style
Compile your Style
 
We Need to Talk About CSS
We Need to Talk About CSSWe Need to Talk About CSS
We Need to Talk About CSS
 
Sass:-Syntactically Awesome Stylesheet by Shafeeq
Sass:-Syntactically Awesome Stylesheet by ShafeeqSass:-Syntactically Awesome Stylesheet by Shafeeq
Sass:-Syntactically Awesome Stylesheet by Shafeeq
 
Full
FullFull
Full
 
Css Systems
Css SystemsCss Systems
Css Systems
 
Efficiently theming a multi-site Drupal 8 portal - Drupal Dev Days Seville 2017
Efficiently theming a multi-site Drupal 8 portal - Drupal Dev Days Seville 2017Efficiently theming a multi-site Drupal 8 portal - Drupal Dev Days Seville 2017
Efficiently theming a multi-site Drupal 8 portal - Drupal Dev Days Seville 2017
 
Drupal Camp Manila 2014 - Theming with Zen
Drupal Camp Manila 2014 - Theming with ZenDrupal Camp Manila 2014 - Theming with Zen
Drupal Camp Manila 2014 - Theming with Zen
 
Drupal 6 Overview
Drupal 6 OverviewDrupal 6 Overview
Drupal 6 Overview
 
Drupal Theming
Drupal Theming Drupal Theming
Drupal Theming
 
CSS Training in Bangalore
CSS Training in BangaloreCSS Training in Bangalore
CSS Training in Bangalore
 
HTML and CSS Coding Standards
HTML and CSS Coding StandardsHTML and CSS Coding Standards
HTML and CSS Coding Standards
 

More from Eric Sembrat

WPCampus 2019 - Website Renewal Services
WPCampus 2019 - Website Renewal ServicesWPCampus 2019 - Website Renewal Services
WPCampus 2019 - Website Renewal ServicesEric Sembrat
 
September 2018 - Georgia Tech - Science Communications Workshop - Building We...
September 2018 - Georgia Tech - Science Communications Workshop - Building We...September 2018 - Georgia Tech - Science Communications Workshop - Building We...
September 2018 - Georgia Tech - Science Communications Workshop - Building We...Eric Sembrat
 
USG Web Tech Day 2018 - Microsoft Teams, Collaboration, & You
USG Web Tech Day 2018 - Microsoft Teams, Collaboration, & YouUSG Web Tech Day 2018 - Microsoft Teams, Collaboration, & You
USG Web Tech Day 2018 - Microsoft Teams, Collaboration, & YouEric Sembrat
 
USG Web Tech Day 2017 - CMS Tunnel Vision
USG Web Tech Day 2017 - CMS Tunnel VisionUSG Web Tech Day 2017 - CMS Tunnel Vision
USG Web Tech Day 2017 - CMS Tunnel VisionEric Sembrat
 
USG Rock Eagle 2017 - PWP at 1000 Days
USG Rock Eagle 2017 - PWP at 1000 DaysUSG Rock Eagle 2017 - PWP at 1000 Days
USG Rock Eagle 2017 - PWP at 1000 DaysEric Sembrat
 
HighEdWeb 2017 - Unbundle Your Institution: Building a Web Ecosystem
HighEdWeb 2017 - Unbundle Your Institution: Building a Web EcosystemHighEdWeb 2017 - Unbundle Your Institution: Building a Web Ecosystem
HighEdWeb 2017 - Unbundle Your Institution: Building a Web EcosystemEric Sembrat
 
January 2017 - WPCampus Online - Learning from Drupal: Implementing WordPress...
January 2017 - WPCampus Online - Learning from Drupal: Implementing WordPress...January 2017 - WPCampus Online - Learning from Drupal: Implementing WordPress...
January 2017 - WPCampus Online - Learning from Drupal: Implementing WordPress...Eric Sembrat
 
November 2016 - ECN - You're Speaking Drupalese to Me
November 2016 - ECN - You're Speaking Drupalese to MeNovember 2016 - ECN - You're Speaking Drupalese to Me
November 2016 - ECN - You're Speaking Drupalese to MeEric Sembrat
 
November 2016 - Georgia Tech - Building a Research Website
November 2016 - Georgia Tech - Building a Research WebsiteNovember 2016 - Georgia Tech - Building a Research Website
November 2016 - Georgia Tech - Building a Research WebsiteEric Sembrat
 
October 2016 - USG Rock Eagle - Everything You Need to Know to Plan Your Drup...
October 2016 - USG Rock Eagle - Everything You Need to Know to Plan Your Drup...October 2016 - USG Rock Eagle - Everything You Need to Know to Plan Your Drup...
October 2016 - USG Rock Eagle - Everything You Need to Know to Plan Your Drup...Eric Sembrat
 
October 2016 - edUi - Save Us, Self Service!
October 2016 - edUi - Save Us, Self Service!October 2016 - edUi - Save Us, Self Service!
October 2016 - edUi - Save Us, Self Service!Eric Sembrat
 
August 2016 - DrupalCorn - The Paragraphs Cake - Structured & Layered Content...
August 2016 - DrupalCorn - The Paragraphs Cake - Structured & Layered Content...August 2016 - DrupalCorn - The Paragraphs Cake - Structured & Layered Content...
August 2016 - DrupalCorn - The Paragraphs Cake - Structured & Layered Content...Eric Sembrat
 
April 2016 - Atlanta WordPress Users Group - Child Themes
April 2016 - Atlanta WordPress Users Group - Child ThemesApril 2016 - Atlanta WordPress Users Group - Child Themes
April 2016 - Atlanta WordPress Users Group - Child ThemesEric Sembrat
 
October 2015 - USG Rock Eagle - USGweb
October 2015 - USG Rock Eagle - USGwebOctober 2015 - USG Rock Eagle - USGweb
October 2015 - USG Rock Eagle - USGwebEric Sembrat
 
October 2015 - USG Rock Eagle - Drupal 8
October 2015 - USG Rock Eagle - Drupal 8October 2015 - USG Rock Eagle - Drupal 8
October 2015 - USG Rock Eagle - Drupal 8Eric Sembrat
 
USG Rock Eagle - October 2015 - PWP at Georgia Tech
USG Rock Eagle - October 2015 - PWP at Georgia TechUSG Rock Eagle - October 2015 - PWP at Georgia Tech
USG Rock Eagle - October 2015 - PWP at Georgia TechEric Sembrat
 
Atlanta Drupal Users Group - October 2015 - Success of the GT Redesign
Atlanta Drupal Users Group - October 2015 - Success of the GT RedesignAtlanta Drupal Users Group - October 2015 - Success of the GT Redesign
Atlanta Drupal Users Group - October 2015 - Success of the GT RedesignEric Sembrat
 
August 2015 - Web Governance - PWP Introduction
August 2015 - Web Governance - PWP IntroductionAugust 2015 - Web Governance - PWP Introduction
August 2015 - Web Governance - PWP IntroductionEric Sembrat
 
Atlanta Drupal User's Group - April 2015 - Sasstronauts: Advanced Sass Topics
Atlanta Drupal User's Group - April 2015 - Sasstronauts: Advanced Sass TopicsAtlanta Drupal User's Group - April 2015 - Sasstronauts: Advanced Sass Topics
Atlanta Drupal User's Group - April 2015 - Sasstronauts: Advanced Sass TopicsEric Sembrat
 
Georgia Tech Drupal Users Group - March 2015
Georgia Tech Drupal Users Group - March 2015Georgia Tech Drupal Users Group - March 2015
Georgia Tech Drupal Users Group - March 2015Eric Sembrat
 

More from Eric Sembrat (20)

WPCampus 2019 - Website Renewal Services
WPCampus 2019 - Website Renewal ServicesWPCampus 2019 - Website Renewal Services
WPCampus 2019 - Website Renewal Services
 
September 2018 - Georgia Tech - Science Communications Workshop - Building We...
September 2018 - Georgia Tech - Science Communications Workshop - Building We...September 2018 - Georgia Tech - Science Communications Workshop - Building We...
September 2018 - Georgia Tech - Science Communications Workshop - Building We...
 
USG Web Tech Day 2018 - Microsoft Teams, Collaboration, & You
USG Web Tech Day 2018 - Microsoft Teams, Collaboration, & YouUSG Web Tech Day 2018 - Microsoft Teams, Collaboration, & You
USG Web Tech Day 2018 - Microsoft Teams, Collaboration, & You
 
USG Web Tech Day 2017 - CMS Tunnel Vision
USG Web Tech Day 2017 - CMS Tunnel VisionUSG Web Tech Day 2017 - CMS Tunnel Vision
USG Web Tech Day 2017 - CMS Tunnel Vision
 
USG Rock Eagle 2017 - PWP at 1000 Days
USG Rock Eagle 2017 - PWP at 1000 DaysUSG Rock Eagle 2017 - PWP at 1000 Days
USG Rock Eagle 2017 - PWP at 1000 Days
 
HighEdWeb 2017 - Unbundle Your Institution: Building a Web Ecosystem
HighEdWeb 2017 - Unbundle Your Institution: Building a Web EcosystemHighEdWeb 2017 - Unbundle Your Institution: Building a Web Ecosystem
HighEdWeb 2017 - Unbundle Your Institution: Building a Web Ecosystem
 
January 2017 - WPCampus Online - Learning from Drupal: Implementing WordPress...
January 2017 - WPCampus Online - Learning from Drupal: Implementing WordPress...January 2017 - WPCampus Online - Learning from Drupal: Implementing WordPress...
January 2017 - WPCampus Online - Learning from Drupal: Implementing WordPress...
 
November 2016 - ECN - You're Speaking Drupalese to Me
November 2016 - ECN - You're Speaking Drupalese to MeNovember 2016 - ECN - You're Speaking Drupalese to Me
November 2016 - ECN - You're Speaking Drupalese to Me
 
November 2016 - Georgia Tech - Building a Research Website
November 2016 - Georgia Tech - Building a Research WebsiteNovember 2016 - Georgia Tech - Building a Research Website
November 2016 - Georgia Tech - Building a Research Website
 
October 2016 - USG Rock Eagle - Everything You Need to Know to Plan Your Drup...
October 2016 - USG Rock Eagle - Everything You Need to Know to Plan Your Drup...October 2016 - USG Rock Eagle - Everything You Need to Know to Plan Your Drup...
October 2016 - USG Rock Eagle - Everything You Need to Know to Plan Your Drup...
 
October 2016 - edUi - Save Us, Self Service!
October 2016 - edUi - Save Us, Self Service!October 2016 - edUi - Save Us, Self Service!
October 2016 - edUi - Save Us, Self Service!
 
August 2016 - DrupalCorn - The Paragraphs Cake - Structured & Layered Content...
August 2016 - DrupalCorn - The Paragraphs Cake - Structured & Layered Content...August 2016 - DrupalCorn - The Paragraphs Cake - Structured & Layered Content...
August 2016 - DrupalCorn - The Paragraphs Cake - Structured & Layered Content...
 
April 2016 - Atlanta WordPress Users Group - Child Themes
April 2016 - Atlanta WordPress Users Group - Child ThemesApril 2016 - Atlanta WordPress Users Group - Child Themes
April 2016 - Atlanta WordPress Users Group - Child Themes
 
October 2015 - USG Rock Eagle - USGweb
October 2015 - USG Rock Eagle - USGwebOctober 2015 - USG Rock Eagle - USGweb
October 2015 - USG Rock Eagle - USGweb
 
October 2015 - USG Rock Eagle - Drupal 8
October 2015 - USG Rock Eagle - Drupal 8October 2015 - USG Rock Eagle - Drupal 8
October 2015 - USG Rock Eagle - Drupal 8
 
USG Rock Eagle - October 2015 - PWP at Georgia Tech
USG Rock Eagle - October 2015 - PWP at Georgia TechUSG Rock Eagle - October 2015 - PWP at Georgia Tech
USG Rock Eagle - October 2015 - PWP at Georgia Tech
 
Atlanta Drupal Users Group - October 2015 - Success of the GT Redesign
Atlanta Drupal Users Group - October 2015 - Success of the GT RedesignAtlanta Drupal Users Group - October 2015 - Success of the GT Redesign
Atlanta Drupal Users Group - October 2015 - Success of the GT Redesign
 
August 2015 - Web Governance - PWP Introduction
August 2015 - Web Governance - PWP IntroductionAugust 2015 - Web Governance - PWP Introduction
August 2015 - Web Governance - PWP Introduction
 
Atlanta Drupal User's Group - April 2015 - Sasstronauts: Advanced Sass Topics
Atlanta Drupal User's Group - April 2015 - Sasstronauts: Advanced Sass TopicsAtlanta Drupal User's Group - April 2015 - Sasstronauts: Advanced Sass Topics
Atlanta Drupal User's Group - April 2015 - Sasstronauts: Advanced Sass Topics
 
Georgia Tech Drupal Users Group - March 2015
Georgia Tech Drupal Users Group - March 2015Georgia Tech Drupal Users Group - March 2015
Georgia Tech Drupal Users Group - March 2015
 

Recently uploaded

Man or Manufactured_ Redefining Humanity Through Biopunk Narratives.pptx
Man or Manufactured_ Redefining Humanity Through Biopunk Narratives.pptxMan or Manufactured_ Redefining Humanity Through Biopunk Narratives.pptx
Man or Manufactured_ Redefining Humanity Through Biopunk Narratives.pptxDhatriParmar
 
Narcotic and Non Narcotic Analgesic..pdf
Narcotic and Non Narcotic Analgesic..pdfNarcotic and Non Narcotic Analgesic..pdf
Narcotic and Non Narcotic Analgesic..pdfPrerana Jadhav
 
Using Grammatical Signals Suitable to Patterns of Idea Development
Using Grammatical Signals Suitable to Patterns of Idea DevelopmentUsing Grammatical Signals Suitable to Patterns of Idea Development
Using Grammatical Signals Suitable to Patterns of Idea Developmentchesterberbo7
 
Beauty Amidst the Bytes_ Unearthing Unexpected Advantages of the Digital Wast...
Beauty Amidst the Bytes_ Unearthing Unexpected Advantages of the Digital Wast...Beauty Amidst the Bytes_ Unearthing Unexpected Advantages of the Digital Wast...
Beauty Amidst the Bytes_ Unearthing Unexpected Advantages of the Digital Wast...DhatriParmar
 
Blowin' in the Wind of Caste_ Bob Dylan's Song as a Catalyst for Social Justi...
Blowin' in the Wind of Caste_ Bob Dylan's Song as a Catalyst for Social Justi...Blowin' in the Wind of Caste_ Bob Dylan's Song as a Catalyst for Social Justi...
Blowin' in the Wind of Caste_ Bob Dylan's Song as a Catalyst for Social Justi...DhatriParmar
 
Reading and Writing Skills 11 quarter 4 melc 1
Reading and Writing Skills 11 quarter 4 melc 1Reading and Writing Skills 11 quarter 4 melc 1
Reading and Writing Skills 11 quarter 4 melc 1GloryAnnCastre1
 
Unraveling Hypertext_ Analyzing Postmodern Elements in Literature.pptx
Unraveling Hypertext_ Analyzing  Postmodern Elements in  Literature.pptxUnraveling Hypertext_ Analyzing  Postmodern Elements in  Literature.pptx
Unraveling Hypertext_ Analyzing Postmodern Elements in Literature.pptxDhatriParmar
 
Multi Domain Alias In the Odoo 17 ERP Module
Multi Domain Alias In the Odoo 17 ERP ModuleMulti Domain Alias In the Odoo 17 ERP Module
Multi Domain Alias In the Odoo 17 ERP ModuleCeline George
 
Grade Three -ELLNA-REVIEWER-ENGLISH.pptx
Grade Three -ELLNA-REVIEWER-ENGLISH.pptxGrade Three -ELLNA-REVIEWER-ENGLISH.pptx
Grade Three -ELLNA-REVIEWER-ENGLISH.pptxkarenfajardo43
 
Student Profile Sample - We help schools to connect the data they have, with ...
Student Profile Sample - We help schools to connect the data they have, with ...Student Profile Sample - We help schools to connect the data they have, with ...
Student Profile Sample - We help schools to connect the data they have, with ...Seán Kennedy
 
Measures of Position DECILES for ungrouped data
Measures of Position DECILES for ungrouped dataMeasures of Position DECILES for ungrouped data
Measures of Position DECILES for ungrouped dataBabyAnnMotar
 
Q-Factor HISPOL Quiz-6th April 2024, Quiz Club NITW
Q-Factor HISPOL Quiz-6th April 2024, Quiz Club NITWQ-Factor HISPOL Quiz-6th April 2024, Quiz Club NITW
Q-Factor HISPOL Quiz-6th April 2024, Quiz Club NITWQuiz Club NITW
 
Mythology Quiz-4th April 2024, Quiz Club NITW
Mythology Quiz-4th April 2024, Quiz Club NITWMythology Quiz-4th April 2024, Quiz Club NITW
Mythology Quiz-4th April 2024, Quiz Club NITWQuiz Club NITW
 
ESP 4-EDITED.pdfmmcncncncmcmmnmnmncnmncmnnjvnnv
ESP 4-EDITED.pdfmmcncncncmcmmnmnmncnmncmnnjvnnvESP 4-EDITED.pdfmmcncncncmcmmnmnmncnmncmnnjvnnv
ESP 4-EDITED.pdfmmcncncncmcmmnmnmncnmncmnnjvnnvRicaMaeCastro1
 
Scientific Writing :Research Discourse
Scientific  Writing :Research  DiscourseScientific  Writing :Research  Discourse
Scientific Writing :Research DiscourseAnita GoswamiGiri
 
ICS2208 Lecture6 Notes for SL spaces.pdf
ICS2208 Lecture6 Notes for SL spaces.pdfICS2208 Lecture6 Notes for SL spaces.pdf
ICS2208 Lecture6 Notes for SL spaces.pdfVanessa Camilleri
 
How to Fix XML SyntaxError in Odoo the 17
How to Fix XML SyntaxError in Odoo the 17How to Fix XML SyntaxError in Odoo the 17
How to Fix XML SyntaxError in Odoo the 17Celine George
 
Mental Health Awareness - a toolkit for supporting young minds
Mental Health Awareness - a toolkit for supporting young mindsMental Health Awareness - a toolkit for supporting young minds
Mental Health Awareness - a toolkit for supporting young mindsPooky Knightsmith
 

Recently uploaded (20)

Faculty Profile prashantha K EEE dept Sri Sairam college of Engineering
Faculty Profile prashantha K EEE dept Sri Sairam college of EngineeringFaculty Profile prashantha K EEE dept Sri Sairam college of Engineering
Faculty Profile prashantha K EEE dept Sri Sairam college of Engineering
 
Man or Manufactured_ Redefining Humanity Through Biopunk Narratives.pptx
Man or Manufactured_ Redefining Humanity Through Biopunk Narratives.pptxMan or Manufactured_ Redefining Humanity Through Biopunk Narratives.pptx
Man or Manufactured_ Redefining Humanity Through Biopunk Narratives.pptx
 
Narcotic and Non Narcotic Analgesic..pdf
Narcotic and Non Narcotic Analgesic..pdfNarcotic and Non Narcotic Analgesic..pdf
Narcotic and Non Narcotic Analgesic..pdf
 
Using Grammatical Signals Suitable to Patterns of Idea Development
Using Grammatical Signals Suitable to Patterns of Idea DevelopmentUsing Grammatical Signals Suitable to Patterns of Idea Development
Using Grammatical Signals Suitable to Patterns of Idea Development
 
Beauty Amidst the Bytes_ Unearthing Unexpected Advantages of the Digital Wast...
Beauty Amidst the Bytes_ Unearthing Unexpected Advantages of the Digital Wast...Beauty Amidst the Bytes_ Unearthing Unexpected Advantages of the Digital Wast...
Beauty Amidst the Bytes_ Unearthing Unexpected Advantages of the Digital Wast...
 
Blowin' in the Wind of Caste_ Bob Dylan's Song as a Catalyst for Social Justi...
Blowin' in the Wind of Caste_ Bob Dylan's Song as a Catalyst for Social Justi...Blowin' in the Wind of Caste_ Bob Dylan's Song as a Catalyst for Social Justi...
Blowin' in the Wind of Caste_ Bob Dylan's Song as a Catalyst for Social Justi...
 
Reading and Writing Skills 11 quarter 4 melc 1
Reading and Writing Skills 11 quarter 4 melc 1Reading and Writing Skills 11 quarter 4 melc 1
Reading and Writing Skills 11 quarter 4 melc 1
 
Unraveling Hypertext_ Analyzing Postmodern Elements in Literature.pptx
Unraveling Hypertext_ Analyzing  Postmodern Elements in  Literature.pptxUnraveling Hypertext_ Analyzing  Postmodern Elements in  Literature.pptx
Unraveling Hypertext_ Analyzing Postmodern Elements in Literature.pptx
 
Multi Domain Alias In the Odoo 17 ERP Module
Multi Domain Alias In the Odoo 17 ERP ModuleMulti Domain Alias In the Odoo 17 ERP Module
Multi Domain Alias In the Odoo 17 ERP Module
 
Grade Three -ELLNA-REVIEWER-ENGLISH.pptx
Grade Three -ELLNA-REVIEWER-ENGLISH.pptxGrade Three -ELLNA-REVIEWER-ENGLISH.pptx
Grade Three -ELLNA-REVIEWER-ENGLISH.pptx
 
Student Profile Sample - We help schools to connect the data they have, with ...
Student Profile Sample - We help schools to connect the data they have, with ...Student Profile Sample - We help schools to connect the data they have, with ...
Student Profile Sample - We help schools to connect the data they have, with ...
 
Measures of Position DECILES for ungrouped data
Measures of Position DECILES for ungrouped dataMeasures of Position DECILES for ungrouped data
Measures of Position DECILES for ungrouped data
 
Q-Factor HISPOL Quiz-6th April 2024, Quiz Club NITW
Q-Factor HISPOL Quiz-6th April 2024, Quiz Club NITWQ-Factor HISPOL Quiz-6th April 2024, Quiz Club NITW
Q-Factor HISPOL Quiz-6th April 2024, Quiz Club NITW
 
Mythology Quiz-4th April 2024, Quiz Club NITW
Mythology Quiz-4th April 2024, Quiz Club NITWMythology Quiz-4th April 2024, Quiz Club NITW
Mythology Quiz-4th April 2024, Quiz Club NITW
 
ESP 4-EDITED.pdfmmcncncncmcmmnmnmncnmncmnnjvnnv
ESP 4-EDITED.pdfmmcncncncmcmmnmnmncnmncmnnjvnnvESP 4-EDITED.pdfmmcncncncmcmmnmnmncnmncmnnjvnnv
ESP 4-EDITED.pdfmmcncncncmcmmnmnmncnmncmnnjvnnv
 
Scientific Writing :Research Discourse
Scientific  Writing :Research  DiscourseScientific  Writing :Research  Discourse
Scientific Writing :Research Discourse
 
ICS2208 Lecture6 Notes for SL spaces.pdf
ICS2208 Lecture6 Notes for SL spaces.pdfICS2208 Lecture6 Notes for SL spaces.pdf
ICS2208 Lecture6 Notes for SL spaces.pdf
 
How to Fix XML SyntaxError in Odoo the 17
How to Fix XML SyntaxError in Odoo the 17How to Fix XML SyntaxError in Odoo the 17
How to Fix XML SyntaxError in Odoo the 17
 
prashanth updated resume 2024 for Teaching Profession
prashanth updated resume 2024 for Teaching Professionprashanth updated resume 2024 for Teaching Profession
prashanth updated resume 2024 for Teaching Profession
 
Mental Health Awareness - a toolkit for supporting young minds
Mental Health Awareness - a toolkit for supporting young mindsMental Health Awareness - a toolkit for supporting young minds
Mental Health Awareness - a toolkit for supporting young minds
 

April 2016 - MiniCamp Atlanta - SMACSS - Preparing Drupal 8 CSS Organization

  • 1. smacssPREPARING DRUPAL 8 CSS ORGANIZATION.
  • 2. SMACSS in Drupal 8 is not required or a standard. However, it is a best-practice. Implementing SMACSS in Drupal 8 is a work-in-progress. A NOTE TO THE READER. hey,listen Follow along: https://www.drupal.org/node/1887922
  • 3. A LITTLE ABOUT MYSELF. ericsembrat Web Manager at the College of Engineering at Georgia Tech. President of the Atlanta Drupal User’s Group. Doctoral student at Georgia State University. Learn more: http://www.webbeh.com
  • 5. CONTROL-F ALL DAY. disorganized CSS best-practices in Drupal 7 didn’t exist beyond basic CSS practices. So, many of your theme frameworks have lots of different confusing CSS organization. Go back in time: https://www.drupal.org/node/302199
  • 6. Our old friend Zen (3.x).
  • 7. Or, our newer friend - Zen (5.x).
  • 8. (how I feel when navigating all the different CSS structures to find relevant styles)
  • 9. there’saneasierwayLET’S BRING SOME BEST-PRACTICES IN FRONT-END INTO DRUPAL.
  • 11. SMACSS (pronounced “smacks”) is more style guide than rigid framework. There is no library within here for you to download or install. SMACSS is a way to examine your design process and as a way to fit those rigid frameworks into a flexible thought process. It is an attempt to document a consistent approach to site development when using CSS. Scalable (and) 
 Modular 
 Architecture (for) CSS
  • 12. Buy the book: https://smacss.com/
  • 13. SMACSS follows object-oriented programming (OO) in that its goals are to: Increase the semantic value of a section of html and content Decrease the expectation of a specific html structure More generally, SMACSS’ focus is on locating and organizing patterns throughout your CSS so that it is reusable and easier to segment and adjust.
  • 14. SMACSS’ design is intended to be a starting point (not an end-all) to building a style guide and CSS standard. Organization is not rigidly defined. A NOTE TO THE READER. hey,listen
  • 16. base Base rules are applied directly to elements through element selectors, descendent selectors, child selectors, pseudo-classes, however not specific class or ID selectors. (remember reset.css? this is where that goes)
  • 17. layout Layout rules apply directly to the sizes and locations of your major template components (header, footer, sidebar, main area).
  • 18. module Minor page components include navigation bars and widgets. They tend to be inside layout components and even within other modules. Modules should be designed so they can exist on their own, which gives them greater flexibility in being combined and moved around to different parts of the design without breaking the layout. With modules we do want to avoid IDs and element selectors. More reuse means classes.
  • 19. state A state is something that augments and overrides all other styles. States are generally applied to the same element as a layout rule or applied to the same element as a base module class.
  • 20. theme A theme defines colors and images that give your application or site its look and feel. Themes can affect any of the primary types. It could override base styles like default link colors. It could change module elements such as chrome colors and borders. It could affect layout with different arrangements. It could also alter how states look.
  • 25. css/ base/ {base file name}.css layout/ {layout file name}.css component/ {component file name}.css theme/ {theme file name}.css File structure for Drupal 8 theme CSS:
  • 26. Always separate Base, Layout, and Component styles into their own files. Drupal will aggregate these separate files into one file, so there is no performance problem with this practice.)
  • 27. For complex themes, consider placing each component or component family in its own file. State rules, including media queries, should be included with the component to which they apply.
  • 29. module_name.module.css: This file should hold the minimal styles needed to get the module's functionality working. (layout, component state styles). module_name.theme.css: This file should hold extra styles to make the module's functionality aesthetically pleasing. (theme styles). module_name.admin.css: This file should hold the minimal styles needed to get the module's admin screens working. (layout, component state styles). On admin screens, the module may choose to load the *.module.css in addition to the *.admin.css file. module_name.admin.theme.css: This file should hold extra styles to make the module's admin screens aesthetically pleasing. (theme styles). File structure for Drupal 8 theme CSS:
  • 30. Note: Modules should never have any base styles. Drupal core's modules do not have any base styles. Instead Drupal core uses the Normalize.css library augmented with a drupal.base.css library.
  • 32. Sass (and contributed plugins) help to encourage consistency through the usage of mixins, variables, loops, and libraries.
  • 39. libsass sass-globbing css3 library (compass, bourbon) plugins as needed cssfiles sassfiles your css (as sass files) compiled css files