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

Somewhat Stylish

Sponsored · SiteGround - Reliable hosting with speed, security, and support you can count on.

Somewhat Stylish

Avatar for Dominic Barker

Dominic Barker

November 03, 2014
Tweet

More Decks by Dominic Barker

Other Decks in Programming

Transcript

  1. CSS is crap • Terrible language generally. • Specificity is

    confusing. • Big files, 80% of which isn’t even used on any particular page. • LESS / SASS help some things, but make others worse.
  2. Store CSS in Javascript {     button:  {  

        background-­‐color:  'red',       border-­‐radius:  '2px'     }   }  
  3. Use React.js mixin /**    *  @jsx  React.DOM    */

      var  React  =  require('react'),     ClassToStyleMixin  =  require('class-­‐to-­‐style');   var  Button  =  React.createClass({     mixins:  [ClassToStyleMixin]     render:  function()  {       return  (         <a  className={styles.button}>           {this.props.text}         </a>       );     }   });   module.exports  =  Button;  
  4. Good • No more Stylesheets. • Fine grained control over

    element’s styles. • Faster browser perfomance. • Only have what you need.
  5. Not good • Uses inline styles. • Larger page size.

    • Lots of duplication. • More complex.