SlideShare a Scribd company logo
1 of 46
Adaptive Theming
using Compass + <Susy> grid
Mikhutkin Alexander
Frontend developer
Adaptive theming
SCSS files structure
Susy grid
HTML в panels, views, panes
Responsive images (module resp_img)
Abstract classes, Mixins
Site optimization
About
Adaptive theming
Adaptive theming
Layout based on the proportions (fluid grid)
Fluid media
Media queries
What we need?
Adaptive theming
Basic principles
Mobile First
Code optimization- SASS, SCSS(CSS), HTML
Images optimization
Adaptive theming
Mobile First
Adaptive theming
Mobile Last
Mobile First
Media queries
@media only screen and (min-width: 480px) {
mobile styles here
}
@media only screen and (min-width: 768px) {
tablet portrait styles here
}
@media only screen and (min-width: 980px) {
tablet landscape, notebooks, some desktops styles
here
}
@media only screen and (min-width: 1380px) {
desktops styles here
}
Base styles for old phones
Adaptive theming
Fluid media - it's simple
img,
video,
iframe,
object,
embed {
max-width: 100%;
}
Adaptive theming
base
ie.scss
mixins-vars outer-modules pages partials
layout
global
reset
tabs
variables
mixins
module
front
section
article
header
footer
blocks
screen.scss
maintenance.scss
CSS
fonts etc. etc.
@import "compass"
etc.
SCSS files structure
Структура файлов в тме
Siteie.css
screen.css
maintenance .css
CCS structure upcoming to site
SCSS Aggregate
CSS
GZIP
SCSS files structure
Welcome, Susy
@import "susy";
Basic settings$total-columns: 12;
$column-width: 60px; // rem, em, %
$gutter-width: 20px; // rem, em, %
$grid-padding: $gutter-width;
require "susy";
Susy grid
Usage
#page {
@include $container;
}
#main {
@include $span-columns(8);
}
#sidebar {
@include $span-columns(4 omega);
}
#page
#sidebar#main
Susy grid
#page
#main#sidebar
Usage
#page {
@include $container;
}
#main {
@include $span-columns(8 omega);
}
#sidebar {
@include $span-columns(4);
}
Susy grid
#main {
width: 65.95745%;
float: left;
margin-right: 2.12766%;
display: inline;
}
#sidebar {
width: 31.91489%;
float: right;
margin-right: 0;
display: inline;
}
#page {
max-width: 980px;
_width: 980px;
padding-left: 20px;
padding-right: 20px;
margin-left: auto;
margin-right: auto;
}
#page:after {
content: "";
display: table;
clear: both;
}
Outputted CSS
Susy grid
#subheader {
@include $span-columns(8, 8);
}
#content {
@include $span-columns(6, 8);
}
#main#main {
@include $span-columns(8);
}
#nav {
@include $span-columns(2 omega, 8);
}
#subheader
#content #nav
Usage nested elements
Susy grid
#subheader {
width: 100%;
float: left;
margin-right: 3.22581%;
display: inline;
}
#nav {
width: 22.58065%;
float: right;
margin-right: 0;
display: inline;
}
Outputted CSS
#content {
width: 74.19355%;
float: left;
margin-right: 3.22581%;
display: inline;
}
Susy grid
media-layout: 12; // Use the 12 and column layout with the minimum width (980px in this case)
media-layout: 780px; // Use the next layout with a minimum width of 780px
media-layout: 780px 16; // Use 16-columnar layout with a minimum width of 780px
media-layout: 12 780px; // Use 12-columnar layout to a maximum width of 780px
media-layout: 920px 780px; // Use the layout between the values ​​of the nearest (to the lowest (820px))
media-layout: 780px 16 920px; // Use the 16-count. layout between the values
media-layout: 920px 16 780px; // The same as the previous one, the highest value is taken
Media Layouts
Susy responsive grid
SCSS
@include at-breakpoint (780px 12 920px) {
#page {
#content {
@include span-columns(8, 12);
}
}
}
#page {
@include container;
}
$total-columns: 16;
#page {
width: 100%;
float: left;
margin-right: 2.12766%;
display: inline;
}
@media (min-width: 780px) and (max-width: 920px) {
}
#page #content {
width: 65.95745%;
float: left;
margin-right: 2.12766%;
}
Responsive Mixins
CSS
Susy responsive grid
at-breakpoint
@include at-breakpoint (780px 12 920px) {
@include layout ( 6 ) {
#page {
//some stuffs
}
}
}
#page {
max-width: 500px;
padding-left: 20px;
padding-right: 20px;
margin-left: auto;
margin-right: auto;
}
}
#page:after {
content: "";
display: table;
clear: both;
}
Susy responsive grid
Responsive Mixins
SCSS
@media (min-width: 780px) and (max-width: 920px) {
CSS
layout
@include with-grid-settings (12, 35px, 15px, 15px) {
#page {
@include container;
}
}
Responsive Mixins
Susy responsive grid
with-grid-settings (columns, column width, gutter, padding)
with-grid-settings
.element { @include prefix(2); }
.element { @include suffix(2); }
Paddings
.element { @include pad(2, 3); }
.element { @include bleed(2); }
.element { @include pre(2); }
.element { @include post(2); }
Margins
.element { @include squish(2, 3); }
.element { @include push(2); }
.element { @include pull(2); }
Margins and Paddings
Susy responsive grid
.element { @include span-columns(6); }
Reset columns
.full-width .element { @include reset-columns; }
.element { @include span-columns(6 omega); }
Remove omega
.full-width .element { @include remove-omega; }
.element { @include remove-nth-omega(3n); }
Remove nth-omega
Susy responsive grid
Reset mixins
and you'll like ...
Try it
Susy responsive grid
ALLEVIATE
HTML
?
Alleviate HTML
"HTML5 in Drupal 7"
Nathan Smith
BLOCK.tpl.php
FIELD.tpl.php
REGION.tpl.php
VIEWS-VIEW.tpl.php
PAGE.tpl.php
Alleviate HTML
PAGE.tpl.php
<?php print render($page['content']);
BLOCK.tpl.php
<?php print render $content;
REGION.tpl.php
<?php print render $content;
FIELD.tpl.php
<?php print render ('items');
VIEWS-VIEW.tpl.php
много кода, все не влезло :(
Alleviate HTML
Style
Use display default style
No markup at all
List
No style
Rounded corners
https://drupal.org/node/1814696
Patch
Alleviate HTML
Regions and View
Date
Облегчаем HTML
FIELDS
Image
Time
Taxonomy
Title
Body
Link
Customize field HTML
Customize label HTML
Customize field and label wrapper HTML
Add default classes
Theme information
Row style output
Alleviate HTML
Views
Optimization of the whole site
Optimization
Page Speed https://developers.google.com/speed/pagespeed/?hl=ru
YSlow http://developer.yahoo.com/yslow/
WebPageTest http://www.webpagetest.org/
Optimization
Check the speed of the site
Tiny Png http://tinypng.org/ Jpegmini http://jpegmini.com/
Optimization
Optimize images
Module Resp img https://drupal.org/project/resp_img
Original
2000x1447 836 Kb
img { width: 100%; }
CSS
836 Kb
<img src="../cat.jpg"
/>
Resp_img
100 Kb
220x160
220x160
Do not stretch the image with CSS
Optimization
GZIP
Optimization
Compress the data
<head>
</head>
CSS
<body>
</body>
<html>
</html>
Page container
JS
Optimization
CSS at the beginning of the file, JS at the end of the page
Reduce the number of HTTP requests
Sprites
Data URI background: url(data:image/png;base64,iVBO...
Minimize count CSS and JS
Cache
Optimization
Resp img module
Resp img
Создание стиля
Style Name
Machine name
The suffix for the main style
The minimum width of the
screen
Resp img
Minimal style for all images
Updating styles when the width of
the browser window
Настройки
Resp img
Добавление стиля
Basic style
Style Name
Resp img
Настройка стилей
Resp img
Drupal Image styles
Resp img
What we get
Resp img
Desktop Tablet
Phone Landscape Phone Portrait
600 Kb
300 Kb
100 Kb
75 Kb
600 Kb
75 Kb
A little bonus
Bonus
Bonus
Abstract classes
%border-bottom {
border-bottom: 1px solid #ccc;
}
.news-item {
//... some rules
@extend %border-bottom;
}
SCSS CSS
.article h3 {
//... some rules
@extend %border-bottom;
}
.news-item,
.article h3 {
border-bottom: 1px solid #ccc;
}
Bonus
Mixins
@mixin sprite ( $sprite, $x, $y, $bgcolor: transparent ) {
background: $bgcolor url( $sprite ) no-repeat $x $y;
}
.facebook-icon {
//... some rules
@include sprite($sprite, 10px, 20px);
}
@mixin font-size ( $sizeValue: 14 ) {
font-size: ( $sizeValue ) + px;
font-size: ( $sizeValue / 16 ) + rem;
}
.news-item {
//... some rules
@include font-size(16);
}
Bonus
Mixins
@mixin links ( $color: #f37ad9, $hover: #9a9995, $dec: false) {
color: $color;
@if $dec == true {
text-decoration: underline;
&:hover {
color: $hover;
}
}
@if $dec == false {
text-decoration: none;
&:hover {
color: $hover;
}
}
}
.some-link {
//... some rules
@include links( #1794c8, #73e8b2);
}
Thank you for your attention!
Questions?
Reported:
Mikhutkin Alexander
alexander.mikhutkin@propeople.com.ua
weareporpeople.com

More Related Content

What's hot

SASS is more than LESS
SASS is more than LESSSASS is more than LESS
SASS is more than LESS
Itai Koren
 
Introduction to SASS
Introduction to SASSIntroduction to SASS
Introduction to SASS
Jon Dean
 

What's hot (20)

GOTO Berlin - You can use CSS for that
GOTO Berlin - You can use CSS for thatGOTO Berlin - You can use CSS for that
GOTO Berlin - You can use CSS for that
 
CSS Grid vs. Flexbox
CSS Grid vs. FlexboxCSS Grid vs. Flexbox
CSS Grid vs. Flexbox
 
The Future of Frontend - what is new in CSS?
The Future of Frontend - what is new in CSS?The Future of Frontend - what is new in CSS?
The Future of Frontend - what is new in CSS?
 
Bootstrap Framework
Bootstrap Framework Bootstrap Framework
Bootstrap Framework
 
Css3 and gwt in perfect harmony
Css3 and gwt in perfect harmonyCss3 and gwt in perfect harmony
Css3 and gwt in perfect harmony
 
Introducing CSS Grid Layout
Introducing CSS Grid LayoutIntroducing CSS Grid Layout
Introducing CSS Grid Layout
 
Laracon Online: Grid and Flexbox
Laracon Online: Grid and FlexboxLaracon Online: Grid and Flexbox
Laracon Online: Grid and Flexbox
 
Confoo: The New CSS Layout
Confoo: The New CSS LayoutConfoo: The New CSS Layout
Confoo: The New CSS Layout
 
Solving Layout Problems with CSS Grid & Friends - NordicJS
Solving Layout Problems with CSS Grid & Friends - NordicJSSolving Layout Problems with CSS Grid & Friends - NordicJS
Solving Layout Problems with CSS Grid & Friends - NordicJS
 
Preprocessor presentation
Preprocessor presentationPreprocessor presentation
Preprocessor presentation
 
CSS3 meets GWT with GSS
CSS3 meets GWT with GSSCSS3 meets GWT with GSS
CSS3 meets GWT with GSS
 
CSS Grid Layout
CSS Grid LayoutCSS Grid Layout
CSS Grid Layout
 
CSS Grid Layout - All Things Open
CSS Grid Layout - All Things OpenCSS Grid Layout - All Things Open
CSS Grid Layout - All Things Open
 
SASS is more than LESS
SASS is more than LESSSASS is more than LESS
SASS is more than LESS
 
Next-level CSS
Next-level CSSNext-level CSS
Next-level CSS
 
Open Web Camp: CSS3 Implementable Features
Open Web Camp: CSS3 Implementable FeaturesOpen Web Camp: CSS3 Implementable Features
Open Web Camp: CSS3 Implementable Features
 
Introduction to SASS
Introduction to SASSIntroduction to SASS
Introduction to SASS
 
Flexbox and Grid Layout
Flexbox and Grid LayoutFlexbox and Grid Layout
Flexbox and Grid Layout
 
Render Conf: Start using CSS Grid Layout Today
Render Conf: Start using CSS Grid Layout TodayRender Conf: Start using CSS Grid Layout Today
Render Conf: Start using CSS Grid Layout Today
 
CSS Grid Layout - An Event Apart Orlando
CSS Grid Layout - An Event Apart OrlandoCSS Grid Layout - An Event Apart Orlando
CSS Grid Layout - An Event Apart Orlando
 

Viewers also liked

Fancy Page with LaTeX
Fancy Page with LaTeX Fancy Page with LaTeX
Fancy Page with LaTeX
Hirwanto Iwan
 
Lecture 1 particle view of matter
Lecture 1   particle view of matterLecture 1   particle view of matter
Lecture 1 particle view of matter
Chantel Davis
 
Adobe InDesign CC with LaTeX
Adobe InDesign CC with LaTeXAdobe InDesign CC with LaTeX
Adobe InDesign CC with LaTeX
Hirwanto Iwan
 
Simfonia orhideelor
Simfonia orhideelorSimfonia orhideelor
Simfonia orhideelor
krizma
 
Engineering club presentation (072813) (modified)
Engineering club presentation (072813) (modified)Engineering club presentation (072813) (modified)
Engineering club presentation (072813) (modified)
vazqueb
 
European grand prix (F-1 Race)
European grand prix (F-1 Race)European grand prix (F-1 Race)
European grand prix (F-1 Race)
Jessica Ampater
 

Viewers also liked (18)

bacon.js
bacon.jsbacon.js
bacon.js
 
презентация
презентацияпрезентация
презентация
 
Fancy Page with LaTeX
Fancy Page with LaTeX Fancy Page with LaTeX
Fancy Page with LaTeX
 
Lecture 1 particle view of matter
Lecture 1   particle view of matterLecture 1   particle view of matter
Lecture 1 particle view of matter
 
Apol 120 week 5
Apol 120 week 5Apol 120 week 5
Apol 120 week 5
 
Gourmetbarna
GourmetbarnaGourmetbarna
Gourmetbarna
 
Cultuurforum 2016 Wikipedia: Een platform om levend erfgoed te documenteren 1
Cultuurforum 2016 Wikipedia: Een platform om levend erfgoed te documenteren 1Cultuurforum 2016 Wikipedia: Een platform om levend erfgoed te documenteren 1
Cultuurforum 2016 Wikipedia: Een platform om levend erfgoed te documenteren 1
 
Adobe InDesign CC with LaTeX
Adobe InDesign CC with LaTeXAdobe InDesign CC with LaTeX
Adobe InDesign CC with LaTeX
 
Simfonia orhideelor
Simfonia orhideelorSimfonia orhideelor
Simfonia orhideelor
 
Engineering club presentation (072813) (modified)
Engineering club presentation (072813) (modified)Engineering club presentation (072813) (modified)
Engineering club presentation (072813) (modified)
 
Lx font
Lx fontLx font
Lx font
 
Qttc2
Qttc2 Qttc2
Qttc2
 
All That You Need to Know about a Startup
All That You Need to Know about a StartupAll That You Need to Know about a Startup
All That You Need to Know about a Startup
 
Unlocking the Central Banks
Unlocking the Central BanksUnlocking the Central Banks
Unlocking the Central Banks
 
Eureka!
Eureka!Eureka!
Eureka!
 
Mybility by posso
Mybility by possoMybility by posso
Mybility by posso
 
Adel abouhana HRMS implementation
Adel abouhana HRMS implementationAdel abouhana HRMS implementation
Adel abouhana HRMS implementation
 
European grand prix (F-1 Race)
European grand prix (F-1 Race)European grand prix (F-1 Race)
European grand prix (F-1 Race)
 

Similar to Adaptive theming using compass susy grid

MW2011 Grid-based Web Design presentation
MW2011 Grid-based Web Design presentationMW2011 Grid-based Web Design presentation
MW2011 Grid-based Web Design presentation
Charlie Moad
 
2009_09_11_Grid960
2009_09_11_Grid9602009_09_11_Grid960
2009_09_11_Grid960
LightSpeed
 
Lect-4-Responsive-Web-06032024-082044am.pptx
Lect-4-Responsive-Web-06032024-082044am.pptxLect-4-Responsive-Web-06032024-082044am.pptx
Lect-4-Responsive-Web-06032024-082044am.pptx
zainm7032
 

Similar to Adaptive theming using compass susy grid (20)

Responsive Web Design e a Ubiquidade da Web
Responsive Web Design e a Ubiquidade da WebResponsive Web Design e a Ubiquidade da Web
Responsive Web Design e a Ubiquidade da Web
 
Responsive Web Design & APEX Theme 25
Responsive Web Design & APEX Theme 25Responsive Web Design & APEX Theme 25
Responsive Web Design & APEX Theme 25
 
Adobe MAX 2008: HTML/CSS + Fireworks
Adobe MAX 2008: HTML/CSS + FireworksAdobe MAX 2008: HTML/CSS + Fireworks
Adobe MAX 2008: HTML/CSS + Fireworks
 
Responsive web design
Responsive web designResponsive web design
Responsive web design
 
Responsive Web Design & APEX Theme 25 (OGh APEX World 2014)
Responsive Web Design & APEX Theme 25 (OGh APEX World 2014)Responsive Web Design & APEX Theme 25 (OGh APEX World 2014)
Responsive Web Design & APEX Theme 25 (OGh APEX World 2014)
 
MW2011 Grid-based Web Design presentation
MW2011 Grid-based Web Design presentationMW2011 Grid-based Web Design presentation
MW2011 Grid-based Web Design presentation
 
Best Practices for Android UI by RapidValue Solutions
Best Practices for Android UI by RapidValue SolutionsBest Practices for Android UI by RapidValue Solutions
Best Practices for Android UI by RapidValue Solutions
 
2009_09_11_Grid960
2009_09_11_Grid9602009_09_11_Grid960
2009_09_11_Grid960
 
An Introduction to Responsive Design
An Introduction to Responsive DesignAn Introduction to Responsive Design
An Introduction to Responsive Design
 
Lect-4-Responsive-Web-06032024-082044am.pptx
Lect-4-Responsive-Web-06032024-082044am.pptxLect-4-Responsive-Web-06032024-082044am.pptx
Lect-4-Responsive-Web-06032024-082044am.pptx
 
Responsive grids overview
Responsive grids overviewResponsive grids overview
Responsive grids overview
 
Pinkoi Mobile Web
Pinkoi Mobile WebPinkoi Mobile Web
Pinkoi Mobile Web
 
HTML CSS & Javascript
HTML CSS & JavascriptHTML CSS & Javascript
HTML CSS & Javascript
 
Create Responsive Website Design with Bootstrap 3
Create Responsive Website Design with Bootstrap 3Create Responsive Website Design with Bootstrap 3
Create Responsive Website Design with Bootstrap 3
 
Building high performing web pages
Building high performing web pagesBuilding high performing web pages
Building high performing web pages
 
Building websites and leading librarians to a new level of project engagement
Building websites and leading librarians to a new level of project engagementBuilding websites and leading librarians to a new level of project engagement
Building websites and leading librarians to a new level of project engagement
 
Death of a Themer
Death of a ThemerDeath of a Themer
Death of a Themer
 
Bootstrap 3
Bootstrap 3Bootstrap 3
Bootstrap 3
 
Responsive layouts by Maqbool
Responsive layouts by MaqboolResponsive layouts by Maqbool
Responsive layouts by Maqbool
 
CSS
CSSCSS
CSS
 

Recently uploaded

Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Safe Software
 

Recently uploaded (20)

ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
Navi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Navi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot ModelNavi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Navi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot Model
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
 
Ransomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdfRansomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdf
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
MS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsMS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectors
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 

Adaptive theming using compass susy grid

  • 1. Adaptive Theming using Compass + <Susy> grid Mikhutkin Alexander Frontend developer
  • 2. Adaptive theming SCSS files structure Susy grid HTML в panels, views, panes Responsive images (module resp_img) Abstract classes, Mixins Site optimization About
  • 4. Layout based on the proportions (fluid grid) Fluid media Media queries What we need? Adaptive theming
  • 5. Basic principles Mobile First Code optimization- SASS, SCSS(CSS), HTML Images optimization Adaptive theming
  • 7. Media queries @media only screen and (min-width: 480px) { mobile styles here } @media only screen and (min-width: 768px) { tablet portrait styles here } @media only screen and (min-width: 980px) { tablet landscape, notebooks, some desktops styles here } @media only screen and (min-width: 1380px) { desktops styles here } Base styles for old phones Adaptive theming
  • 8. Fluid media - it's simple img, video, iframe, object, embed { max-width: 100%; } Adaptive theming
  • 9. base ie.scss mixins-vars outer-modules pages partials layout global reset tabs variables mixins module front section article header footer blocks screen.scss maintenance.scss CSS fonts etc. etc. @import "compass" etc. SCSS files structure
  • 10. Структура файлов в тме Siteie.css screen.css maintenance .css CCS structure upcoming to site SCSS Aggregate CSS GZIP SCSS files structure
  • 11. Welcome, Susy @import "susy"; Basic settings$total-columns: 12; $column-width: 60px; // rem, em, % $gutter-width: 20px; // rem, em, % $grid-padding: $gutter-width; require "susy"; Susy grid
  • 12. Usage #page { @include $container; } #main { @include $span-columns(8); } #sidebar { @include $span-columns(4 omega); } #page #sidebar#main Susy grid
  • 13. #page #main#sidebar Usage #page { @include $container; } #main { @include $span-columns(8 omega); } #sidebar { @include $span-columns(4); } Susy grid
  • 14. #main { width: 65.95745%; float: left; margin-right: 2.12766%; display: inline; } #sidebar { width: 31.91489%; float: right; margin-right: 0; display: inline; } #page { max-width: 980px; _width: 980px; padding-left: 20px; padding-right: 20px; margin-left: auto; margin-right: auto; } #page:after { content: ""; display: table; clear: both; } Outputted CSS Susy grid
  • 15. #subheader { @include $span-columns(8, 8); } #content { @include $span-columns(6, 8); } #main#main { @include $span-columns(8); } #nav { @include $span-columns(2 omega, 8); } #subheader #content #nav Usage nested elements Susy grid
  • 16. #subheader { width: 100%; float: left; margin-right: 3.22581%; display: inline; } #nav { width: 22.58065%; float: right; margin-right: 0; display: inline; } Outputted CSS #content { width: 74.19355%; float: left; margin-right: 3.22581%; display: inline; } Susy grid
  • 17. media-layout: 12; // Use the 12 and column layout with the minimum width (980px in this case) media-layout: 780px; // Use the next layout with a minimum width of 780px media-layout: 780px 16; // Use 16-columnar layout with a minimum width of 780px media-layout: 12 780px; // Use 12-columnar layout to a maximum width of 780px media-layout: 920px 780px; // Use the layout between the values ​​of the nearest (to the lowest (820px)) media-layout: 780px 16 920px; // Use the 16-count. layout between the values media-layout: 920px 16 780px; // The same as the previous one, the highest value is taken Media Layouts Susy responsive grid
  • 18. SCSS @include at-breakpoint (780px 12 920px) { #page { #content { @include span-columns(8, 12); } } } #page { @include container; } $total-columns: 16; #page { width: 100%; float: left; margin-right: 2.12766%; display: inline; } @media (min-width: 780px) and (max-width: 920px) { } #page #content { width: 65.95745%; float: left; margin-right: 2.12766%; } Responsive Mixins CSS Susy responsive grid at-breakpoint
  • 19. @include at-breakpoint (780px 12 920px) { @include layout ( 6 ) { #page { //some stuffs } } } #page { max-width: 500px; padding-left: 20px; padding-right: 20px; margin-left: auto; margin-right: auto; } } #page:after { content: ""; display: table; clear: both; } Susy responsive grid Responsive Mixins SCSS @media (min-width: 780px) and (max-width: 920px) { CSS layout
  • 20. @include with-grid-settings (12, 35px, 15px, 15px) { #page { @include container; } } Responsive Mixins Susy responsive grid with-grid-settings (columns, column width, gutter, padding) with-grid-settings
  • 21. .element { @include prefix(2); } .element { @include suffix(2); } Paddings .element { @include pad(2, 3); } .element { @include bleed(2); } .element { @include pre(2); } .element { @include post(2); } Margins .element { @include squish(2, 3); } .element { @include push(2); } .element { @include pull(2); } Margins and Paddings Susy responsive grid
  • 22. .element { @include span-columns(6); } Reset columns .full-width .element { @include reset-columns; } .element { @include span-columns(6 omega); } Remove omega .full-width .element { @include remove-omega; } .element { @include remove-nth-omega(3n); } Remove nth-omega Susy responsive grid Reset mixins
  • 23. and you'll like ... Try it Susy responsive grid
  • 25. "HTML5 in Drupal 7" Nathan Smith BLOCK.tpl.php FIELD.tpl.php REGION.tpl.php VIEWS-VIEW.tpl.php PAGE.tpl.php Alleviate HTML
  • 26. PAGE.tpl.php <?php print render($page['content']); BLOCK.tpl.php <?php print render $content; REGION.tpl.php <?php print render $content; FIELD.tpl.php <?php print render ('items'); VIEWS-VIEW.tpl.php много кода, все не влезло :( Alleviate HTML
  • 27. Style Use display default style No markup at all List No style Rounded corners https://drupal.org/node/1814696 Patch Alleviate HTML Regions and View
  • 28. Date Облегчаем HTML FIELDS Image Time Taxonomy Title Body Link Customize field HTML Customize label HTML Customize field and label wrapper HTML Add default classes Theme information Row style output Alleviate HTML Views
  • 29. Optimization of the whole site Optimization
  • 30. Page Speed https://developers.google.com/speed/pagespeed/?hl=ru YSlow http://developer.yahoo.com/yslow/ WebPageTest http://www.webpagetest.org/ Optimization Check the speed of the site
  • 31. Tiny Png http://tinypng.org/ Jpegmini http://jpegmini.com/ Optimization Optimize images
  • 32. Module Resp img https://drupal.org/project/resp_img Original 2000x1447 836 Kb img { width: 100%; } CSS 836 Kb <img src="../cat.jpg" /> Resp_img 100 Kb 220x160 220x160 Do not stretch the image with CSS Optimization
  • 35. Reduce the number of HTTP requests Sprites Data URI background: url(data:image/png;base64,iVBO... Minimize count CSS and JS Cache Optimization
  • 37. Создание стиля Style Name Machine name The suffix for the main style The minimum width of the screen Resp img
  • 38. Minimal style for all images Updating styles when the width of the browser window Настройки Resp img
  • 41. Resp img What we get Resp img Desktop Tablet Phone Landscape Phone Portrait 600 Kb 300 Kb 100 Kb 75 Kb 600 Kb 75 Kb
  • 43. Bonus Abstract classes %border-bottom { border-bottom: 1px solid #ccc; } .news-item { //... some rules @extend %border-bottom; } SCSS CSS .article h3 { //... some rules @extend %border-bottom; } .news-item, .article h3 { border-bottom: 1px solid #ccc; }
  • 44. Bonus Mixins @mixin sprite ( $sprite, $x, $y, $bgcolor: transparent ) { background: $bgcolor url( $sprite ) no-repeat $x $y; } .facebook-icon { //... some rules @include sprite($sprite, 10px, 20px); } @mixin font-size ( $sizeValue: 14 ) { font-size: ( $sizeValue ) + px; font-size: ( $sizeValue / 16 ) + rem; } .news-item { //... some rules @include font-size(16); }
  • 45. Bonus Mixins @mixin links ( $color: #f37ad9, $hover: #9a9995, $dec: false) { color: $color; @if $dec == true { text-decoration: underline; &:hover { color: $hover; } } @if $dec == false { text-decoration: none; &:hover { color: $hover; } } } .some-link { //... some rules @include links( #1794c8, #73e8b2); }
  • 46. Thank you for your attention! Questions? Reported: Mikhutkin Alexander alexander.mikhutkin@propeople.com.ua weareporpeople.com