We decided to solve the main
Atomic CSS-related problems
using the power of CSS Modules,
getting all the benefits of both
solutions.
Michele Bertoli
https://medium.com/yplan-eng/atomic-css-modules-cb44d5993b27#.p7jtpneoh
Slide 66
Slide 66 text
Is Origami going to use
CSS Modules?
@onishiweb
Slide 67
Slide 67 text
No.
Slide 68
Slide 68 text
First Class Styles
- Mark Dalgleish
Front Trends 2016
https://www.youtube.com/watch?v=KmtgJ1d4zuY
Slide 69
Slide 69 text
The alternative way…
@onishiweb
Slide 70
Slide 70 text
Delayed
1. Automobiles
2. Trains
3.
Slide 71
Slide 71 text
1. CSS
2. CSS Modules
3. Web Components
Slide 72
Slide 72 text
The Web Components way…
Slide 73
Slide 73 text
Create your own
elements and
encapsulate their CSS
Slide 74
Slide 74 text
@onishiweb
But what does that mean‽
Slide 75
Slide 75 text
This is an image caption
Slide 76
Slide 76 text
Slide 77
Slide 77 text
Warning!
New specifications and lots
of code coming up
@onishiweb
class OGallery extends HTMLElement {
connectedCallback() {
[...]
}
}
Slide 84
Slide 84 text
const oGallery =
document.createElement('o-gallery');
// Show the next slide
oGallery.nextSlide();
// Show the previous slide
oGallery.previousSlide();
Slide 85
Slide 85 text
Slide 86
Slide 86 text
Shadow DOM
@onishiweb
Slide 87
Slide 87 text
This is where things get
spooky and weird!
Soledad Penades
https://www.youtube.com/watch?v=2vWgJ7w3hu0
// Attaches a shadow Root to your element
const shadowRoot = this.attachShadow({mode: 'open'});
// Get the custom template, clone it
const template = document.querySelector('#o-gallery');
const clone = this.importNode(template, true);
// Insert it into our shadow DOM
shadowRoot.appendChild(clone);