Upgrade to Pro — share decks privately, control downloads, hide ads and more …

XXLCSS - How to scale CSS and keep your sanity

XXLCSS - How to scale CSS and keep your sanity

"Web" design has changed. Now is the time to stop and rethink our best practices. Which are the new, better practices and tools that will help us keep our sanity while scaling big projects?

Slides from UpNorth Conference in Athens, Greece.

Zaharenia Atzitzikaki

May 17, 2014
Tweet

More Decks by Zaharenia Atzitzikaki

Other Decks in Design

Transcript

  1. XXLCSS
    How to scale CSS and keep your sanity
    @sugarenia

    View Slide

  2. XXLCSS
    How to scale CSS and keep your sanity
    @sugarenia

    View Slide

  3. I’m Sugar.

    View Slide

  4. I’m a designer.

    View Slide

  5. I’m happy.

    View Slide

  6. Web design is awesome!

    View Slide

  7. Web design is awesome!
    ...sometimes

    View Slide

  8. The problem

    View Slide

  9. Maintainability

    View Slide

  10. View Slide

  11. OOCSS

    View Slide

  12. OOCSS
    SMACSS

    View Slide

  13. OOCSS
    SMACSS
    Sass

    View Slide

  14. OOCSS
    SMACSS
    Sass
    Bootstrap & Foundation

    View Slide

  15. The goals

    View Slide

  16. GOAL #1
    Don’t start from scratch
    every time

    View Slide

  17. GOAL #2
    Markup standards,
    especially for large teams

    View Slide

  18. GOAL #3
    Don’t bug your designers
    about ALL THE THINGS

    View Slide

  19. GOALS #4, #5 & #6
    Flexibility
    Speed
    Performance

    View Slide

  20. GOAL #7
    Own the code

    View Slide

  21. Best practices

    View Slide

  22. Avoid classitis

    View Slide

  23. Avoid extra markup

    View Slide

  24. Non-semantic class names

    View Slide

  25. Use descendant selectors

    View Slide

  26. No.

    View Slide

  27. Better practices

    View Slide

  28. View Slide

  29. Developers know better

    View Slide

  30. Developers know better

    View Slide

  31. Developers know better
    Abstraction

    View Slide

  32. Developers know better
    Abstraction
    Object orientation

    View Slide

  33. Developers know better
    Abstraction
    Object orientation
    Performance first

    View Slide

  34. Developers know better
    Abstraction
    Object orientation
    Performance first
    DRY

    View Slide

  35. Developers know better
    Abstraction
    Object orientation
    Performance first
    DRY
    KISS

    View Slide

  36. No IDs in CSS please

    View Slide

  37. View Slide

  38. #header
    #footer

    View Slide

  39. #header
    #footer
    #footer { background-color: #000; }

    View Slide

  40. #header
    #footer
    #footer { background-color: #000; }
    #footer a { color: #fff; }

    View Slide

  41. #header
    #footer
    .twitter
    #footer { background-color: #000; }
    #footer a { color: #fff; }

    View Slide

  42. #header
    #footer
    .twitter
    #footer { background-color: #000; }
    #footer a { color: #fff; }
    .twitter { background-color: #fff; }

    View Slide

  43. #header
    #footer
    .twitter
    #footer { background-color: #000; }
    #footer a { color: #fff; }
    .twitter { background-color: #fff; }
    .twitter a { color: #000; }

    View Slide

  44. #header
    #footer
    .twitter
    #footer { background-color: #000; }
    #footer a { color: #fff; }
    .twitter { background-color: #fff; }
    .twitter a { color: #000; }

    View Slide

  45. Semantic?

    View Slide

  46. Semantic? Pragmatic.

    View Slide


  47. Big heading


    Sidebar heading


    Footer heading

    View Slide


  48. Big heading


    Sidebar heading


    Footer heading

    h1 { font-size: 3em; }
    h2 { font-size: 2.4em; }
    h3 { font-size: 2em; }
    h4 { font-size: 1.6em; }

    View Slide


  49. Big heading


    Sidebar heading


    Footer heading

    h1 { font-size: 3em; }
    h2,
    .footer h4 { font-size: 2.4em; }
    h3 { font-size: 2em; }
    h4 { font-size: 1.6em; }

    View Slide


  50. Big heading


    Sidebar heading


    Footer heading

    h1, .alpha { font-size: 3em; }
    h2, .beta { font-size: 2.4em; }
    h3, .gamma { font-size: 2em; }
    h4, .delta { font-size: 1.6em; }

    View Slide

  51. Style classes are
    totally OK, dude

    View Slide

  52. Classes work much better when we use them
    to represent visual semantics, rather than
    keeping them tied to content.
    — Nicole Sullivan (@stubbornella)

    View Slide


  53. ...

    View Slide


  54. ...

    View Slide

  55. Descendant selectors
    can bite you

    View Slide


  56. This is the box header

    View Slide


  57. This is the box header

    .box {
    background-color: #fff;
    border: 1px solid #ccc;
    }
    .box h3 {
    text-transform: uppercase;
    color: #333;
    }

    View Slide


  58. This is the box header

    View Slide


  59. This is the box header

    .box {
    background-color: #fff;
    border: 1px solid #ccc;
    }
    .box h3, .box h4 {
    text-transform: uppercase;
    color: #333;
    }

    View Slide


  60. This is the box header

    .box {
    background-color: #fff;
    border: 1px solid #ccc;
    }
    .box-header {
    text-transform: uppercase;
    color: #333;
    }

    View Slide

  61. Modularize

    View Slide

  62. Stop overdesigning

    View Slide

  63. Stop thinking in pages

    View Slide

  64. Everything is a module

    View Slide

  65. View Slide

  66. Lorem ipsum dolor sit amet,
    consectetur adipiscing elit.
    Donec a posuere velit.

    View Slide

  67. Lorem ipsum dolor sit amet,
    consectetur adipiscing elit.
    Donec a posuere velit.

    View Slide

  68. Lorem ipsum dolor sit amet,
    consectetur adipiscing elit.
    Donec a posuere velit.

    View Slide






  69. @Stubbornella 14 minutes ago


    View Slide

  70. .media, .bd { overflow:hidden; }
    .media .img { float:left; margin-right: 10px; }
    .media .img img { display:block; }
    .media .imgExt { float:right; margin-left: 10px; }

    View Slide

  71. Do one thing
    and one thing only

    View Slide

  72. Combine modules
    for fun and profit

    View Slide

  73. Modules should be
    oblivious of their context

    View Slide

  74. Toolbox

    View Slide

  75. View Slide

  76. Preprocessors

    View Slide

  77. Preprocessors
    Sass, that is.

    View Slide

  78. CSS Frameworks

    View Slide

  79. View Slide

  80. ...or UI Toolkits?

    View Slide

  81. The time saved using a css framework is
    spent looking up how to work with that
    framework.
    — Jesse Shawl (@jshawl)

    View Slide

  82. Updating is hell

    View Slide

  83. MY ADVICE
    Roll your own framework

    View Slide

  84. Living style guides

    View Slide

  85. http://style.codeforamerica.org

    View Slide

  86. http://patterns.alistapart.com

    View Slide

  87. Better collaboration

    View Slide

  88. Avoid code duplication

    View Slide

  89. Easy device testing

    View Slide

  90. http://vinspee.me/style-guide-guide/

    View Slide

  91. Do try this at home.

    View Slide

  92. Thanks!
    You rock.
    @sugarenia

    View Slide