The Future is Modular, Jonathan Snook
- 7. Blog Designs
#header h1, #header h2 { font-size:13px; font-weigh… }
#header h1 { color: #680; float:right; padding-b…}
#header h2 { float:left; padding:18px 20px; posi…}
#header h2 img { position:absolute; left:0; top:0; }
#header h2 a { text-decoration:none; color:#333; }
#main h2 {text-transform:uppercase; font-weight:…}
#main h2 a {text-decoration:none; color:#444;}
#main h2 a:hover {color:#680;}
#main .article.inside h1 { text-transform:uppercase;…}
#comments .comment .meta .authorname { text-transfo… }
#comments .comment .meta .commentnumber a { float: … }
- 8. Blog Designs
#header h1, #header h2 { font-size:13px; font-weigh… }
#header h1 { color: #680; float:right; padding-b…}
#header h2 { float:left; padding:18px 20px; posi…}
#header h2 img { position:absolute; left:0; top:0; }
#header h2 a { text-decoration:none; color:#333; }
#main h2 {text-transform:uppercase; font-weight:…}
#main h2 a {text-decoration:none; color:#444;}
#main h2 a:hover {color:#680;}
#main .article.inside h1 { text-transform:uppercase;…}
#comments .comment .meta .authorname { text-transfo… }
#comments .comment .meta .commentnumber a { float: … }
- 9. Blog Designs
#header h1, #header h2 { font-size:13px; font-weigh… }
#header h1 { color: #680; float:right; padding-b…}
#header h2 { float:left; padding:18px 20px; posi…}
#header h2 img { position:absolute; left:0; top:0; }
#header h2 a { text-decoration:none; color:#333; }
#main h2 {text-transform:uppercase; font-weight:…}
#main h2 a {text-decoration:none; color:#444;}
#main h2 a:hover {color:#680;}
#main .article.inside h1 { text-transform:uppercase;…}
#comments .comment .meta .authorname { text-transfo… }
#comments .comment .meta .commentnumber a { float: … }
- 18. • Describes how to approach site design and
development
• No GitHub repo, not a library, not a framework, no
tools
• Techniques can be applied to static CSS, Sass,
React, Web Components, etc.
- 20. A module is “each of a set of
standardized parts or independent
units that can be used to construct
a more complex structure.”
–Dictionary
- 34. The cascade is how the
browser decides what
properties to apply when you
have multiple rules declared
on the same element.
- 35. • Don’t write multiple rules for the same element
• Inline styles
• Create a structured layering system to prevent
conflicts
- 54. If Module A
in Module B
in Layout C
Then I’m screwed.
- 72. • .btn
• .btn--variation
• .btn__component
• .btn
• &--variation
• &__component
• button.css
• .variation
• .component
SMACSS-y
BEM
Sass
CSS
Modules/React
• .btn
• .btn-variation
• .btn--component
- 76. var XUIButton = React.createClass({
render: function() {
return (
<button className="{this.props.type}">
{this.props.children}
</button>
);
}
});
- 77. var myStyle = {
color: '#FFF',
backgroundColor: '#330000'
}
var XUIButton = React.createClass({
render: function() {
return (
<button style="{myStyle}">
{this.props.children}
</button>
);
}
- 81. var p = document.createElement(‘p');
p.createShadowRoot();
p.shadowRoot.innerHTML = 'HTML Contents';
document.body.appendChild(p);
- 82. • The Cascade no longer applies
• Inheritance still applies
(unless you use all:initial)
- 88. // Creates a MediaObjectElement class
// that extends HTMLElement.
class MediaObjectElement extends HTMLElement {
createdCallback() {
var shadowRoot = this.createShadowRoot();
shadowRoot.innerHTML = 'Shadow DOM contents...';
}
}
// Registers the `<custom-element>` element for use.
document.registerElement('custom-element',
MediaObjectElement);
- 89. • Likely a year before all browsers support
everything.
• JavaScript Dependent
• Phillip Walton’s Talk on Modular CSS with Web
Components
http://snk.ms/27
- 90. • Think about standardized and modular design.
• Frameworks like React can help.
• Web Components are coming. (So is winter.)