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

ARCHITECTING SCALABLE CSS

ARCHITECTING SCALABLE CSS

A story for searching solution for better CSS management code.

Irfan Maulana

February 03, 2017
Tweet

More Decks by Irfan Maulana

Other Decks in Programming

Transcript

  1. About Me • Name : Irfan Maulana (mazipan) • Job

    : Software Development Engineer • Specialize : Front End Web Developer
  2. Who we are ? • We are Blibli.com • E-commerce

    that start from 5 years ago. • We want to be no.1 E-commerce in Indonesia with the most Loyal and Satisfy customer.
  3. What we will talk about ? • Finding a better

    way in write and maintain CSS code
  4. 1. Analyzing Problem • Less modularity • Too much file

    and classes that not represent its function or places. • Tons of confusions e.g. not clear dependency (we are afraid about removing and adding things) • Problem with scalability, consistency and on- boarding new developers. • Specificity. Too deep selector. • Have no standard. • 1 page always giving to 1 person.
  5. 2. Set Acceptance Criteria After got the problems, lets set

    our acceptance criteria to any new solution options…
  6. 2. Set Acceptance Criteria • Modular and Independent • Re-usable,

    Easy to extends, Easy to override • Readable and Easy Tracking • Less bloated code (Unused code) • Has Good Conventions (Standard) • Easy to learn
  7. 3. Finding Solution We found our problem, we have set

    our acceptance criteria. Lets finding the solution together…
  8. 3. Finding Solution Lucky ! Google show the way… Google

    says that SASS is one of solution to reach our first acceptance criteria. So what is SASS ya ?
  9. 3. Finding Solution Sass is CSS Pre-Processor, lets you use

    features that don't exist in CSS yet like variables, nesting, mixins, inheritance and other nifty goodies that make writing CSS fun again. But wait, Lets try to find another specific keyword…
  10. 3. Finding Solution Lets see the red line. Pre-processor is

    good for modularity but not giving an independence. Independence gain after implement one of architectures or conventions… Hmmm, Architectures in CSS ? Conventions ? Sounds interesting.
  11. 3. Finding Solution There is many convention, ex : SMACSS,

    OOCSS, BEM, Atomic, DRY CSS, etc. After reading some of architecture out there, I feel in love with one of them. BEM
  12. 3. Finding Solution Lookup to our acceptance criteria… • Modular

    and Independent • Re-usable, Easy to extends, Easy to override • Readable and Easy Tracking • Less bloated code (Unused code) • Has Good Conventions (Standard) • Easy to learn
  13. SASS + BEM See the BEM : https://mazipan.github.io/ See the

    Framework : https://github.com/mazipan/bem-kit
  14. 4. Challenge • SASS is good pre-processor for newbies but

    for simplify your code you need to learn advance syntax in SASS. • BEM is just convention, need commitment from developer to follow the rules. • Keep the independence of blocks in BEM is hard if we still have a page based vision. • Managing BEM is not easy for team that has different knowledge.
  15. 5. Conclusion Scalable CSS means that your code is easy

    to learn, easy to update, easy to track by team. Scalable CSS should make you have fast development in new feature without breaking old feature. Scalable CSS should have good and proven convention/standard to make it keep controllable. Scalable CSS should performance first concern with less unused code.
  16. Contact Me • Facebook : /mazipanneh • Twitter : @mazipan

    • Linkedin : /in/irfanmaulanamazipan • Slideshare : /IrfanMaulana21 • Speakerdeck : /mazipan • Github : mazipan • Gh Pages : mazipan.github.io • Blog : mazipanneh, @mazipanneh • Email : [email protected]