SlideShare une entreprise Scribd logo
1  sur  37
Télécharger pour lire hors ligne
#RWD WITH SASS+COMPASS
                              Come On Get Sassy




Sunday, July 22, 12
WHO AM I?
                      Sam Richard             Organizer of NYC
                                              Responsive Web Design
                      Frontend Developer      Meetup

                      @Snugug on Twitter      Co-Organizer of NYC Sass
                                              Meetup
                      Snugug on D.O.
                                              Co-Organizer of SassConf
                      Very Sassy Man




Sunday, July 22, 12
WHAT IS THIS SESSION?
                      I WILL:                     I WON’T:

                        Give you an overview of     Try and convince you
                        some tools and              to start building
                        techniques for RWD          Responsively

                        Show you how to use         Teach the basics of
                        Sass+Compass in new         Sass+Compass
                        and exciting ways for
                        RWD and Progressive         Show you how to
                        Enhancement                 compile Sass with
                                                    Drupal


Sunday, July 22, 12
WHAT FEATURES DO YOU NEED FOR
                 RESPONSIVE WEB DESIGN?

                      As outlined in Ethan Marcotte’s Phrase-Coining A List Apart
                      article, Responsive Web Design needs the three following
                      things:
                           Fluid Grids
                           Media Queries
                           Flexible Media



Sunday, July 22, 12
WHAT PRINCIPLES DO YOU NEED
                      FOR RESPONSIVE WEB DESIGN?
                      Design your websites for Mobile First
                      Make Content and Navigation primary concerns over visual flair
                      and social sharing
                      Embrace Progressive Enhancement and build on standard
                      Web technologies (HTML/CSS/JS)
                      Design on a grid, ideally one specific to your design
                      Design in Browser



Sunday, July 22, 12
You can’t articulate fluidity on
                                  paper.
                                               Brad Frost




Sunday, July 22, 12
THE TOOLS OF THE TRADE
                      Sass+Compass                      Modern Web Browser (I like
                                                        Google Chrome)
                         Susy Compass Extension
                                                        LiveReload
                         Breakpoint / Respond-to
                         Compass Extensions             Adobe Shadow + Devices

                         Toolkit Compass Extension      Illustrator for creating vector
                                                        graphics
                      Modernizr

                      Text Editor (I like TextMate or
                      Sublime Text)


Sunday, July 22, 12
STUFF TO AVOID

                      Browser Plugins (like Flash and Silverlight)
                      Single browser prefixes (just -webkit, just -moz, etc…)
                      CSS Frameworks
                      The phrase “Pixel Perfect”
                      Photoshop
                      Designing around known devices
                      Device Detection



Sunday, July 22, 12
The web is an inherently unstable
                                  medium
                                             Ethan Marcotte




Sunday, July 22, 12
Brad Frost

Sunday, July 22, 12
The point of creating [responsive] sites is to create
                  functional (and hopefully optimal) user experiences for a
                   growing number of web-enabled devices and contexts.
                                                             Brad Frost




Sunday, July 22, 12
Repeat after me: Responsive Web Design isn’t
                  about current devices and known unknowns, it’s
                   about future devices and unknown unknowns.
                                                 Donald Rumsfeld




Sunday, July 22, 12
Your device detection is bad and
                            you should feel bad
                                           Dr. John A. Zoidberg




Sunday, July 22, 12
BEFORE YOU GO ANYWHERE, LET’S
                         CHEAT AT CSS
                 @import 'compass';


                 * { @include box-sizing('border-box'); }
                 // From Paul Irish's Blog Post




Sunday, July 22, 12
SUSY
                        FLUID GRIDS FULL OF WIN
                 > gem install susy --pre


                 require 'susy'


                 @import "susy";


                 $total-columns: 12;
                 $column-width: 4em;
                 $gutter-width: 1em;
                 $grid-padding: $gutter-width;




Sunday, July 22, 12
SUSY
                        FLUID GRIDS FULL OF WIN
                 #page-wrapper {
                   @include container;
                 }

                 #main {
                   @include span-columns(8);
                 }

                 #sidebar-first {
                   @include span-columns(4 omega);
                 }




Sunday, July 22, 12
SUSY
                         FLUID GRIDS FULL OF WIN
                 #page-wrapper {         #main {
                   *zoom: 1;               width: 66.102%;
                   max-width: 59em;        float: left;
                   _width: 59em;           margin-right: 1.695%;
                   margin-left: auto;      display: inline;
                   margin-right: auto;   }
                   padding-left: 1em;
                   padding-right: 1em;   #sidebar-first {
                 }                         width: 32.203%;
                                           float: right;
                 #page-wrapper:after {     margin-right: 0;
                   content: "";            #margin-left: -1em;
                   display: table;         display: inline;
                   clear: both;          }
                 }




Sunday, July 22, 12
SUSY
                        FLUID GRIDS FULL OF WIN
                 #user-name {
                   @include span-columns(3, 4);
                 }

                 #social {
                   @include span-columns(1 omega, 4);
                 }




Sunday, July 22, 12
SUSY
                        FLUID GRIDS FULL OF WIN
                 #user-name {              #social {
                   width: 73.684%;           width: 21.053%;
                   float: left;              float: right;
                   margin-right: 5.263%;     margin-right: 0;
                   display: inline;          #margin-left: -1em;
                 }                           display: inline;
                                           }




Sunday, July 22, 12
BREAKPOINT
                      MEDIA QUERIES MADE EASY
                 > gem install breakpoint


                 require 'breakpoint'


                 @import "breakpoint";


                 $breakpoint-default-media: 'all';
                 $breakpoint-default-feature: 'min-width';
                 $breakpoint-default-pair: 'width';
                 $breakpoint-to-ems: false;




Sunday, July 22, 12
Start with the small screen first,
                      then expand until it looks like shit.
                         TIME FOR A BREAKPOINT!
                                                    Stephen Hay




Sunday, July 22, 12
BREAKPOINT
                             MEDIA QUERIES MADE EASY
                 $main-nav-inline: 482px;
                 $main-nav-inline-right: 823px;

                 #main-nav {
                   clear: both;

                      li {
                        display: block;

                          @include breakpoint($main-nav-inline) {
                            display: inline-block;
                          }
                      }

                      @include breakpoint($main-nav-inline-large) {
                        @include span-columns(9 omega);
                      }
                 }


Sunday, July 22, 12
BREAKPOINT
                      MEDIA QUERIES MADE EASY
                 #main-nav {         @media (min-width: 482px) {
                   clear: both;        #main-nav li {
                 }                       display: inline-block
                                       }
                 #main-nav li {      }
                   display: block;
                 }                   @media (min-width: 823px) {
                                       #main-nav {
                                         width: 74.576%;
                                         float: right;
                                         margin-right: 0;
                                         #margin-left: -1em;
                                         display: inline;
                                       }
                                     }


Sunday, July 22, 12
BREAKPOINT
                      MEDIA QUERIES MADE EASY
                 $breakpoint-to-ems: true;   @media (min-width: 30.125em) {
                                               #main-nav li {
                                                 display: inline-block
                 #main-nav {
                                               }
                   clear: both;
                                             }
                 }

                                             @media (min-width: 51.438em) {
                 #main-nav li {
                                               #main-nav {
                   display: block;
                                                 width: 74.576%;
                 }
                                                 float: right;
                                                 margin-right: 0;
                                                 #margin-left: -1em;
                                                 display: inline;
                                               }
                                             }


Sunday, July 22, 12
RESPOND-TO
                      SEMANTIC BREAKPOINT NAMING
                 $breakpoints: 'inline main navigation' (482px),
                               'inline main navigation, floated right' (823px);

                 #main-nav {
                   clear: both;

                      li {
                        display: block;

                          @include respond-to('inline main navigation') {
                            display: inline-block;
                          }

                          @include respond-to('inline main navigation, floated right') {
                            @include span-columns(9 omega);
                          }
                      }
                 }


Sunday, July 22, 12
TOOLKIT
                  FOR MODERN WEB DEVELOPMENT
                 > gem install toolkit


                 require 'toolkit'




Sunday, July 22, 12
A NOTE ON RESPONSIVE MEDIA

                      Sass will not magically give you Responsive Media. Neither will
                      Compass, Modernizr, any CSS or JS Framework, or even Drupal.
                      For Responsive Media to be a reality, we need a new browser
                      based standard. There are currently some proposed solutions
                      for Images, and Apple is forging ahead with a non-standard
                      solution in iOS6, but until then, everything is a hack.
                      There are some tricks you can do in CSS to make media Fluid,
                      however, and Sass rocks at this.



Sunday, July 22, 12
TOOLKIT
                               FOR FLUID MEDIA
                 @import "toolkit/fluid-media";


                 // Included Automatically
                 img {
                   max-width: 100%;
                   height: auto;
                 }

                                              .bar {
                 .foo {
                                                @include scale-
                   @include scale-elements;
                                              elements($ratio: 4/3);
                 }
                                              }




Sunday, July 22, 12
TOOLKIT
                               FOR FLUID MEDIA
                 .foo, .bar {            .foo {
                   position: relative;     padding-top: 56.25%;
                   height: 0;              width: 100%;
                 }                       }

                 .foo > *, .bar > * {    .bar {
                   display: block;         padding-top: 75%;
                   position: absolute;     width: 100%;
                   width: 100%;          }
                   height: 100%;
                   top: 0;
                   margin: 0;
                   padding: 0;
                 }

Sunday, July 22, 12
TOOLKIT
                      FOR PROGRESSIVE ENHANCEMENT
                 Download a custom build of Modernizr


                 @import "toolkit/pe";


                 .foo {
                   @include enhance-with('touch') {
                     min-height: 44px;
                   }

                      @include degrade-from('touch') {
                        min-height: 20px;
                      }
                 }


Sunday, July 22, 12
TOOLKIT
                      FOR PROGRESSIVE ENHANCEMENT
                 .touch .foo {
                   min-height: 44px;
                 }
                 .no-touch .foo, .no-js .foo {
                   min-height: 20px;
                 }




Sunday, July 22, 12
TOOLKIT
                      FOR PROGRESSIVE ENHANCEMENT
                 $user-bar-icons: "assets/user-bar/*.png";
                 @include sprite-map-generator($user-bar-icons);

                 .bar {
                   @include replace-text-pe($user-bar-icons, 'user');
                 }

                 .baz {
                   @include replace-text-pe($user-bar-icons, 'necktie',
                 $inline-svg: false);
                 }




Sunday, July 22, 12
TOOLKIT
                      FOR PROGRESSIVE ENHANCEMENT
                 > create images/assets/user-bar-s01cf12a717.png          .bar {
                                                                            width: 24px;
                                                                            height: 21px;
                                                                          }
                                                                          .svg .bar {
                 .bar, .baz {                                               background-image: url('data:image/svg
                   text-indent: 110%;                                     +xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0…');
                   white-space: nowrap;                                     background-size: 24px 21px;
                   overflow: hidden;                                      }
                 }                                                        .no-svg .bar, .no-js .bar {
                                                                            background-position: 0 -18px;
                 .no-svg .bar, .no-js .bar, .no-svg .baz, .no-js .baz {   }
                   background-image: url('../images/assets/user-bar-
                 s01cf12a717.png');
                   background-repeat: no-repeat;
                                                                          .baz {
                 }
                                                                            width: 8px;
                                                                            height: 27px;
                                                                          }
                                                                          .svg .baz {
                                                                            background-image: url('../images/assets/user-bar/
                                                                          necktie.svg?1341407937');
                                                                            background-size: 8px 27px;
                                                                          }
                                                                          .no-svg .baz, .no-js .baz {
                                                                            background-position: 0 -39px;
                                                                          }




Sunday, July 22, 12
TOOLKIT
               TO KICKSTART YOUR DEVELOPMENT
                 Existing Project
                 require 'toolkit'

                 > compass install toolkit
                 - or -
                 > compass install toolkit/respond-to

                 New Project
                 > compass create <my_project> -r toolkit --using toolkit
                 - or -
                 > compass create <my_project> -r toolkit --using
                 toolkit/respond-to




Sunday, July 22, 12
TOOLKIT
               TO KICKSTART YOUR DEVELOPMENT
                      Compass                Development Modernizr
                                             Build with yepnope
                      Toolkit
                                             loader.js to hold yepnope
                      Susy                   tests

                      Either Breakpoint or   hammer.js for touch events
                      Respond-to
                                             Sass stylesheets and
                      Border Box Box Model   default, empty partials




Sunday, July 22, 12
DID I MENTION…



                      Everything you just saw? Yah, it’s all backend independent. You
                      can use it anywhere, with anything, for any project. Sass Rocks.




Sunday, July 22, 12
GO FORTH, BE RESPONSIVE, AND
                         MAY THE SASS BE WITH YOU
                      People to Follow:                   If you liked this talk, I’m Sam
                      @Snugug, @Compass, @TheSassWay,     Richard. If not, I was Mason
                      @GoTeamSass, @CodingDesigner,
                      @ScottKellum, @ItsMissCS,           Wendell.
                      @ChrisEppstein, @nex3, @beep,
                      @lukew, @brad_frost, @globalmoxie
                                                          If you have questions, come
                                                          to my BoFs tomorrow or
                      Things to Read:
                      http://snugug.com/rwd               find me. I’m happy to talk.
                      http://snugug.com/pe-pattern
                      http://snugug.com/breakpoint
                      http://snugug.com/toolkit
                                                          Please rate this session
                      http://snugug.com/rwd-mobile        (and all of the others)!
                      http://snugug.com/munich            Thank you!



Sunday, July 22, 12

Contenu connexe

En vedette

Q3 Spring Release Feature Round Up
Q3 Spring Release Feature Round UpQ3 Spring Release Feature Round Up
Q3 Spring Release Feature Round UpMarketo
 
Attract More Customers with Inbound and Outbound Marketing
Attract More Customers with Inbound and Outbound MarketingAttract More Customers with Inbound and Outbound Marketing
Attract More Customers with Inbound and Outbound MarketingMarketo
 
Marketo User Groups: Account-Based Marketing
Marketo User Groups: Account-Based MarketingMarketo User Groups: Account-Based Marketing
Marketo User Groups: Account-Based MarketingMarketo
 
Quarterly Feature Round Up Webinar
Quarterly Feature Round Up WebinarQuarterly Feature Round Up Webinar
Quarterly Feature Round Up WebinarMarketo
 
5 Marketing Strategies for Customer Engagement
5 Marketing Strategies for Customer Engagement5 Marketing Strategies for Customer Engagement
5 Marketing Strategies for Customer EngagementMarketo
 
10 Best Productivity Hacks for Customer Service
10 Best Productivity Hacks for Customer Service10 Best Productivity Hacks for Customer Service
10 Best Productivity Hacks for Customer ServiceAdam Toporek
 
So you want to quit your day job and make a connected product
So you want to quit your day job and make a connected productSo you want to quit your day job and make a connected product
So you want to quit your day job and make a connected productAlexandra Deschamps-Sonsino
 
The New Assembly Line: 3 Best Practices for Building (Secure) Connected Cars
The New Assembly Line: 3 Best Practices for Building (Secure) Connected CarsThe New Assembly Line: 3 Best Practices for Building (Secure) Connected Cars
The New Assembly Line: 3 Best Practices for Building (Secure) Connected CarsLookout
 

En vedette (8)

Q3 Spring Release Feature Round Up
Q3 Spring Release Feature Round UpQ3 Spring Release Feature Round Up
Q3 Spring Release Feature Round Up
 
Attract More Customers with Inbound and Outbound Marketing
Attract More Customers with Inbound and Outbound MarketingAttract More Customers with Inbound and Outbound Marketing
Attract More Customers with Inbound and Outbound Marketing
 
Marketo User Groups: Account-Based Marketing
Marketo User Groups: Account-Based MarketingMarketo User Groups: Account-Based Marketing
Marketo User Groups: Account-Based Marketing
 
Quarterly Feature Round Up Webinar
Quarterly Feature Round Up WebinarQuarterly Feature Round Up Webinar
Quarterly Feature Round Up Webinar
 
5 Marketing Strategies for Customer Engagement
5 Marketing Strategies for Customer Engagement5 Marketing Strategies for Customer Engagement
5 Marketing Strategies for Customer Engagement
 
10 Best Productivity Hacks for Customer Service
10 Best Productivity Hacks for Customer Service10 Best Productivity Hacks for Customer Service
10 Best Productivity Hacks for Customer Service
 
So you want to quit your day job and make a connected product
So you want to quit your day job and make a connected productSo you want to quit your day job and make a connected product
So you want to quit your day job and make a connected product
 
The New Assembly Line: 3 Best Practices for Building (Secure) Connected Cars
The New Assembly Line: 3 Best Practices for Building (Secure) Connected CarsThe New Assembly Line: 3 Best Practices for Building (Secure) Connected Cars
The New Assembly Line: 3 Best Practices for Building (Secure) Connected Cars
 

Plus de nyccamp

Drupal As A Jigsaw
Drupal As A JigsawDrupal As A Jigsaw
Drupal As A Jigsawnyccamp
 
A/B Testing and Optimizely Module
A/B Testing and Optimizely ModuleA/B Testing and Optimizely Module
A/B Testing and Optimizely Modulenyccamp
 
Behat - human-readable automated testing
Behat - human-readable automated testingBehat - human-readable automated testing
Behat - human-readable automated testingnyccamp
 
ALL YOUR BASE (THEMES) ARE BELONG TO US
ALL YOUR BASE (THEMES) ARE BELONG TO USALL YOUR BASE (THEMES) ARE BELONG TO US
ALL YOUR BASE (THEMES) ARE BELONG TO USnyccamp
 
Drupal Commerce - The Product vs Display Conundrum and How to Explain it to a...
Drupal Commerce - The Product vs Display Conundrum and How to Explain it to a...Drupal Commerce - The Product vs Display Conundrum and How to Explain it to a...
Drupal Commerce - The Product vs Display Conundrum and How to Explain it to a...nyccamp
 
Promotions Vouchers and Offers in Drupal Commerce
Promotions Vouchers and Offers in Drupal CommercePromotions Vouchers and Offers in Drupal Commerce
Promotions Vouchers and Offers in Drupal Commercenyccamp
 
Workbench: Managing Content Management
Workbench: Managing Content ManagementWorkbench: Managing Content Management
Workbench: Managing Content Managementnyccamp
 
Deployment Strategies: Managing Code, Content, and Configurations
Deployment Strategies: Managing Code, Content, and ConfigurationsDeployment Strategies: Managing Code, Content, and Configurations
Deployment Strategies: Managing Code, Content, and Configurationsnyccamp
 
Drupal Aware Design: Good Techniques for Better Themes
Drupal Aware Design: Good Techniques for Better ThemesDrupal Aware Design: Good Techniques for Better Themes
Drupal Aware Design: Good Techniques for Better Themesnyccamp
 
Drupal and Higher Education
Drupal and Higher EducationDrupal and Higher Education
Drupal and Higher Educationnyccamp
 
A New Theme Layer for Drupal 8
A New Theme Layer for Drupal 8A New Theme Layer for Drupal 8
A New Theme Layer for Drupal 8nyccamp
 
Mobile and Responsive Design with Sass
Mobile and Responsive Design with SassMobile and Responsive Design with Sass
Mobile and Responsive Design with Sassnyccamp
 
Drupal and Apache Solr Search Go Together Like Pizza and Beer for Your Site
Drupal and Apache Solr Search Go Together Like Pizza and Beer for Your SiteDrupal and Apache Solr Search Go Together Like Pizza and Beer for Your Site
Drupal and Apache Solr Search Go Together Like Pizza and Beer for Your Sitenyccamp
 
Building Social Networks
Building Social NetworksBuilding Social Networks
Building Social Networksnyccamp
 
The State of Drupal 8
The State of Drupal 8The State of Drupal 8
The State of Drupal 8nyccamp
 
Building Social Networks
Building Social NetworksBuilding Social Networks
Building Social Networksnyccamp
 
Move Into Drupal Using The Migrate Module
Move Into Drupal Using The Migrate ModuleMove Into Drupal Using The Migrate Module
Move Into Drupal Using The Migrate Modulenyccamp
 
Hack Into Drupal Sites (or, How to Secure Your Drupal Site)
Hack Into Drupal Sites (or, How to Secure Your Drupal Site)Hack Into Drupal Sites (or, How to Secure Your Drupal Site)
Hack Into Drupal Sites (or, How to Secure Your Drupal Site)nyccamp
 
Drulenium - Testing Made Easy
Drulenium - Testing Made EasyDrulenium - Testing Made Easy
Drulenium - Testing Made Easynyccamp
 
Node Access in Drupal 7 (and Drupal 8)
Node Access in Drupal 7 (and Drupal 8)Node Access in Drupal 7 (and Drupal 8)
Node Access in Drupal 7 (and Drupal 8)nyccamp
 

Plus de nyccamp (20)

Drupal As A Jigsaw
Drupal As A JigsawDrupal As A Jigsaw
Drupal As A Jigsaw
 
A/B Testing and Optimizely Module
A/B Testing and Optimizely ModuleA/B Testing and Optimizely Module
A/B Testing and Optimizely Module
 
Behat - human-readable automated testing
Behat - human-readable automated testingBehat - human-readable automated testing
Behat - human-readable automated testing
 
ALL YOUR BASE (THEMES) ARE BELONG TO US
ALL YOUR BASE (THEMES) ARE BELONG TO USALL YOUR BASE (THEMES) ARE BELONG TO US
ALL YOUR BASE (THEMES) ARE BELONG TO US
 
Drupal Commerce - The Product vs Display Conundrum and How to Explain it to a...
Drupal Commerce - The Product vs Display Conundrum and How to Explain it to a...Drupal Commerce - The Product vs Display Conundrum and How to Explain it to a...
Drupal Commerce - The Product vs Display Conundrum and How to Explain it to a...
 
Promotions Vouchers and Offers in Drupal Commerce
Promotions Vouchers and Offers in Drupal CommercePromotions Vouchers and Offers in Drupal Commerce
Promotions Vouchers and Offers in Drupal Commerce
 
Workbench: Managing Content Management
Workbench: Managing Content ManagementWorkbench: Managing Content Management
Workbench: Managing Content Management
 
Deployment Strategies: Managing Code, Content, and Configurations
Deployment Strategies: Managing Code, Content, and ConfigurationsDeployment Strategies: Managing Code, Content, and Configurations
Deployment Strategies: Managing Code, Content, and Configurations
 
Drupal Aware Design: Good Techniques for Better Themes
Drupal Aware Design: Good Techniques for Better ThemesDrupal Aware Design: Good Techniques for Better Themes
Drupal Aware Design: Good Techniques for Better Themes
 
Drupal and Higher Education
Drupal and Higher EducationDrupal and Higher Education
Drupal and Higher Education
 
A New Theme Layer for Drupal 8
A New Theme Layer for Drupal 8A New Theme Layer for Drupal 8
A New Theme Layer for Drupal 8
 
Mobile and Responsive Design with Sass
Mobile and Responsive Design with SassMobile and Responsive Design with Sass
Mobile and Responsive Design with Sass
 
Drupal and Apache Solr Search Go Together Like Pizza and Beer for Your Site
Drupal and Apache Solr Search Go Together Like Pizza and Beer for Your SiteDrupal and Apache Solr Search Go Together Like Pizza and Beer for Your Site
Drupal and Apache Solr Search Go Together Like Pizza and Beer for Your Site
 
Building Social Networks
Building Social NetworksBuilding Social Networks
Building Social Networks
 
The State of Drupal 8
The State of Drupal 8The State of Drupal 8
The State of Drupal 8
 
Building Social Networks
Building Social NetworksBuilding Social Networks
Building Social Networks
 
Move Into Drupal Using The Migrate Module
Move Into Drupal Using The Migrate ModuleMove Into Drupal Using The Migrate Module
Move Into Drupal Using The Migrate Module
 
Hack Into Drupal Sites (or, How to Secure Your Drupal Site)
Hack Into Drupal Sites (or, How to Secure Your Drupal Site)Hack Into Drupal Sites (or, How to Secure Your Drupal Site)
Hack Into Drupal Sites (or, How to Secure Your Drupal Site)
 
Drulenium - Testing Made Easy
Drulenium - Testing Made EasyDrulenium - Testing Made Easy
Drulenium - Testing Made Easy
 
Node Access in Drupal 7 (and Drupal 8)
Node Access in Drupal 7 (and Drupal 8)Node Access in Drupal 7 (and Drupal 8)
Node Access in Drupal 7 (and Drupal 8)
 

Dernier

SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024Scott Keck-Warren
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationRidwan Fadjar
 
Google AI Hackathon: LLM based Evaluator for RAG
Google AI Hackathon: LLM based Evaluator for RAGGoogle AI Hackathon: LLM based Evaluator for RAG
Google AI Hackathon: LLM based Evaluator for RAGSujit Pal
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Drew Madelung
 
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...HostedbyConfluent
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationSafe Software
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)Gabriella Davis
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityPrincipled Technologies
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking MenDelhi Call girls
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationRadu Cotescu
 
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024BookNet Canada
 
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024BookNet Canada
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsMaria Levchenko
 
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 3652toLead Limited
 
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | DelhiFULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhisoniya singh
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slidespraypatel2
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationMichael W. Hawkins
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxMalak Abu Hammad
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdfhans926745
 
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j
 

Dernier (20)

SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 Presentation
 
Google AI Hackathon: LLM based Evaluator for RAG
Google AI Hackathon: LLM based Evaluator for RAGGoogle AI Hackathon: LLM based Evaluator for RAG
Google AI Hackathon: LLM based Evaluator for RAG
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
 
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
 
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | DelhiFULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slides
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptx
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
 

Responsive Web Design (RWD) with Sass+Compass

  • 1. #RWD WITH SASS+COMPASS Come On Get Sassy Sunday, July 22, 12
  • 2. WHO AM I? Sam Richard Organizer of NYC Responsive Web Design Frontend Developer Meetup @Snugug on Twitter Co-Organizer of NYC Sass Meetup Snugug on D.O. Co-Organizer of SassConf Very Sassy Man Sunday, July 22, 12
  • 3. WHAT IS THIS SESSION? I WILL: I WON’T: Give you an overview of Try and convince you some tools and to start building techniques for RWD Responsively Show you how to use Teach the basics of Sass+Compass in new Sass+Compass and exciting ways for RWD and Progressive Show you how to Enhancement compile Sass with Drupal Sunday, July 22, 12
  • 4. WHAT FEATURES DO YOU NEED FOR RESPONSIVE WEB DESIGN? As outlined in Ethan Marcotte’s Phrase-Coining A List Apart article, Responsive Web Design needs the three following things: Fluid Grids Media Queries Flexible Media Sunday, July 22, 12
  • 5. WHAT PRINCIPLES DO YOU NEED FOR RESPONSIVE WEB DESIGN? Design your websites for Mobile First Make Content and Navigation primary concerns over visual flair and social sharing Embrace Progressive Enhancement and build on standard Web technologies (HTML/CSS/JS) Design on a grid, ideally one specific to your design Design in Browser Sunday, July 22, 12
  • 6. You can’t articulate fluidity on paper. Brad Frost Sunday, July 22, 12
  • 7. THE TOOLS OF THE TRADE Sass+Compass Modern Web Browser (I like Google Chrome) Susy Compass Extension LiveReload Breakpoint / Respond-to Compass Extensions Adobe Shadow + Devices Toolkit Compass Extension Illustrator for creating vector graphics Modernizr Text Editor (I like TextMate or Sublime Text) Sunday, July 22, 12
  • 8. STUFF TO AVOID Browser Plugins (like Flash and Silverlight) Single browser prefixes (just -webkit, just -moz, etc…) CSS Frameworks The phrase “Pixel Perfect” Photoshop Designing around known devices Device Detection Sunday, July 22, 12
  • 9. The web is an inherently unstable medium Ethan Marcotte Sunday, July 22, 12
  • 11. The point of creating [responsive] sites is to create functional (and hopefully optimal) user experiences for a growing number of web-enabled devices and contexts. Brad Frost Sunday, July 22, 12
  • 12. Repeat after me: Responsive Web Design isn’t about current devices and known unknowns, it’s about future devices and unknown unknowns. Donald Rumsfeld Sunday, July 22, 12
  • 13. Your device detection is bad and you should feel bad Dr. John A. Zoidberg Sunday, July 22, 12
  • 14. BEFORE YOU GO ANYWHERE, LET’S CHEAT AT CSS @import 'compass'; * { @include box-sizing('border-box'); } // From Paul Irish's Blog Post Sunday, July 22, 12
  • 15. SUSY FLUID GRIDS FULL OF WIN > gem install susy --pre require 'susy' @import "susy"; $total-columns: 12; $column-width: 4em; $gutter-width: 1em; $grid-padding: $gutter-width; Sunday, July 22, 12
  • 16. SUSY FLUID GRIDS FULL OF WIN #page-wrapper { @include container; } #main { @include span-columns(8); } #sidebar-first { @include span-columns(4 omega); } Sunday, July 22, 12
  • 17. SUSY FLUID GRIDS FULL OF WIN #page-wrapper { #main { *zoom: 1; width: 66.102%; max-width: 59em; float: left; _width: 59em; margin-right: 1.695%; margin-left: auto; display: inline; margin-right: auto; } padding-left: 1em; padding-right: 1em; #sidebar-first { } width: 32.203%; float: right; #page-wrapper:after { margin-right: 0; content: ""; #margin-left: -1em; display: table; display: inline; clear: both; } } Sunday, July 22, 12
  • 18. SUSY FLUID GRIDS FULL OF WIN #user-name { @include span-columns(3, 4); } #social { @include span-columns(1 omega, 4); } Sunday, July 22, 12
  • 19. SUSY FLUID GRIDS FULL OF WIN #user-name { #social { width: 73.684%; width: 21.053%; float: left; float: right; margin-right: 5.263%; margin-right: 0; display: inline; #margin-left: -1em; } display: inline; } Sunday, July 22, 12
  • 20. BREAKPOINT MEDIA QUERIES MADE EASY > gem install breakpoint require 'breakpoint' @import "breakpoint"; $breakpoint-default-media: 'all'; $breakpoint-default-feature: 'min-width'; $breakpoint-default-pair: 'width'; $breakpoint-to-ems: false; Sunday, July 22, 12
  • 21. Start with the small screen first, then expand until it looks like shit. TIME FOR A BREAKPOINT! Stephen Hay Sunday, July 22, 12
  • 22. BREAKPOINT MEDIA QUERIES MADE EASY $main-nav-inline: 482px; $main-nav-inline-right: 823px; #main-nav { clear: both; li { display: block; @include breakpoint($main-nav-inline) { display: inline-block; } } @include breakpoint($main-nav-inline-large) { @include span-columns(9 omega); } } Sunday, July 22, 12
  • 23. BREAKPOINT MEDIA QUERIES MADE EASY #main-nav { @media (min-width: 482px) { clear: both; #main-nav li { } display: inline-block } #main-nav li { } display: block; } @media (min-width: 823px) { #main-nav { width: 74.576%; float: right; margin-right: 0; #margin-left: -1em; display: inline; } } Sunday, July 22, 12
  • 24. BREAKPOINT MEDIA QUERIES MADE EASY $breakpoint-to-ems: true; @media (min-width: 30.125em) { #main-nav li { display: inline-block #main-nav { } clear: both; } } @media (min-width: 51.438em) { #main-nav li { #main-nav { display: block; width: 74.576%; } float: right; margin-right: 0; #margin-left: -1em; display: inline; } } Sunday, July 22, 12
  • 25. RESPOND-TO SEMANTIC BREAKPOINT NAMING $breakpoints: 'inline main navigation' (482px), 'inline main navigation, floated right' (823px); #main-nav { clear: both; li { display: block; @include respond-to('inline main navigation') { display: inline-block; } @include respond-to('inline main navigation, floated right') { @include span-columns(9 omega); } } } Sunday, July 22, 12
  • 26. TOOLKIT FOR MODERN WEB DEVELOPMENT > gem install toolkit require 'toolkit' Sunday, July 22, 12
  • 27. A NOTE ON RESPONSIVE MEDIA Sass will not magically give you Responsive Media. Neither will Compass, Modernizr, any CSS or JS Framework, or even Drupal. For Responsive Media to be a reality, we need a new browser based standard. There are currently some proposed solutions for Images, and Apple is forging ahead with a non-standard solution in iOS6, but until then, everything is a hack. There are some tricks you can do in CSS to make media Fluid, however, and Sass rocks at this. Sunday, July 22, 12
  • 28. TOOLKIT FOR FLUID MEDIA @import "toolkit/fluid-media"; // Included Automatically img { max-width: 100%; height: auto; } .bar { .foo { @include scale- @include scale-elements; elements($ratio: 4/3); } } Sunday, July 22, 12
  • 29. TOOLKIT FOR FLUID MEDIA .foo, .bar { .foo { position: relative; padding-top: 56.25%; height: 0; width: 100%; } } .foo > *, .bar > * { .bar { display: block; padding-top: 75%; position: absolute; width: 100%; width: 100%; } height: 100%; top: 0; margin: 0; padding: 0; } Sunday, July 22, 12
  • 30. TOOLKIT FOR PROGRESSIVE ENHANCEMENT Download a custom build of Modernizr @import "toolkit/pe"; .foo { @include enhance-with('touch') { min-height: 44px; } @include degrade-from('touch') { min-height: 20px; } } Sunday, July 22, 12
  • 31. TOOLKIT FOR PROGRESSIVE ENHANCEMENT .touch .foo { min-height: 44px; } .no-touch .foo, .no-js .foo { min-height: 20px; } Sunday, July 22, 12
  • 32. TOOLKIT FOR PROGRESSIVE ENHANCEMENT $user-bar-icons: "assets/user-bar/*.png"; @include sprite-map-generator($user-bar-icons); .bar { @include replace-text-pe($user-bar-icons, 'user'); } .baz { @include replace-text-pe($user-bar-icons, 'necktie', $inline-svg: false); } Sunday, July 22, 12
  • 33. TOOLKIT FOR PROGRESSIVE ENHANCEMENT > create images/assets/user-bar-s01cf12a717.png .bar { width: 24px; height: 21px; } .svg .bar { .bar, .baz { background-image: url('data:image/svg text-indent: 110%; +xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0…'); white-space: nowrap; background-size: 24px 21px; overflow: hidden; } } .no-svg .bar, .no-js .bar { background-position: 0 -18px; .no-svg .bar, .no-js .bar, .no-svg .baz, .no-js .baz { } background-image: url('../images/assets/user-bar- s01cf12a717.png'); background-repeat: no-repeat; .baz { } width: 8px; height: 27px; } .svg .baz { background-image: url('../images/assets/user-bar/ necktie.svg?1341407937'); background-size: 8px 27px; } .no-svg .baz, .no-js .baz { background-position: 0 -39px; } Sunday, July 22, 12
  • 34. TOOLKIT TO KICKSTART YOUR DEVELOPMENT Existing Project require 'toolkit' > compass install toolkit - or - > compass install toolkit/respond-to New Project > compass create <my_project> -r toolkit --using toolkit - or - > compass create <my_project> -r toolkit --using toolkit/respond-to Sunday, July 22, 12
  • 35. TOOLKIT TO KICKSTART YOUR DEVELOPMENT Compass Development Modernizr Build with yepnope Toolkit loader.js to hold yepnope Susy tests Either Breakpoint or hammer.js for touch events Respond-to Sass stylesheets and Border Box Box Model default, empty partials Sunday, July 22, 12
  • 36. DID I MENTION… Everything you just saw? Yah, it’s all backend independent. You can use it anywhere, with anything, for any project. Sass Rocks. Sunday, July 22, 12
  • 37. GO FORTH, BE RESPONSIVE, AND MAY THE SASS BE WITH YOU People to Follow: If you liked this talk, I’m Sam @Snugug, @Compass, @TheSassWay, Richard. If not, I was Mason @GoTeamSass, @CodingDesigner, @ScottKellum, @ItsMissCS, Wendell. @ChrisEppstein, @nex3, @beep, @lukew, @brad_frost, @globalmoxie If you have questions, come to my BoFs tomorrow or Things to Read: http://snugug.com/rwd find me. I’m happy to talk. http://snugug.com/pe-pattern http://snugug.com/breakpoint http://snugug.com/toolkit Please rate this session http://snugug.com/rwd-mobile (and all of the others)! http://snugug.com/munich Thank you! Sunday, July 22, 12