UVP*

and the future of

CSSinJSΒ 

* Unique Value Proposition

by Oleg Slobodskoi @oleg008

The world’s first
Project Messenger.

Web apps have complex interactions and maintain a state on the client, while web sites mostly render static information.

πŸ’‘

UVP

Unique class name

Modules


Variables

Β etc.

Not a UVP

πŸ“¦Β  Publishing

πŸ‘”Β  Theming
🎏  Data Driven Styling

Agenda

+ πŸš€ Β The Future

πŸ“¦

Publishing

Almost 600K

πŸ“¦

Quality Assurance for JS

Linters

Typings

Tests

Runtime Errors
etc.

Namespacing & specificity

at scale of npm?

😯

Package Block Element Modifier

.package---block--element-modifier {}

πŸ˜‚

πŸ’‘

CSSinJS is
Constraints Automation

Shadow DOMΒ 

Is it ready?

Is it well supported?

Is it fast?

πŸ˜•

Always bet on JavaScript

Or whatever better language will replace it

πŸ˜…

πŸ‘”

Theming

Theme is a config, that

defines look and feel.

πŸ’‘

Material-UI

React Components that Implement Google's Material Design.

Let's try 🍨 CSS!

🏰

Built-in Theme

Switch needs download

Redesign in multi-team setup

πŸ˜”

CSS Variables are subject to the cascade, and inherit their value from their parent.

πŸ’‘

MDN

πŸš™πŸ’₯πŸš—

React's Context is like
CSS Variables

πŸ€·β€β™€οΈ

Create a theme

Use context

NestingΒ 

🎏

Data Driven Styling

State Based

User settings

Weather

Your mood
etc.

Streaming animations

🎏

Google Material Motion for JS

No Transitions
No Keyframes

πŸ˜”

❌

Reconciliation

Styles application

React Inline Styles

🐒

Extreme Perf

60 FPS

JavaScript

One thread

😱

CSSOM FTW

🏎

Create CSS Rule

Update CSS Rule

JSS Function Values

SCU

πŸ€“

Observables

JSS 9 Example

Easy to support

Compatible

RxJS
Bacon.js
Kefir
etc.

Push based

DOM events

Physics Engine

Streams coordination

Observable + CSSOM = ❀️

Decoupled

Lazy

Reusable

πŸš€

Future

The biggest issue at scale we currently have with all CSSinJS implementations is that they are not shareable without the runtime.

πŸ’‘

Interoperable
Style
Transfer
Format

Styled Components

Stylis

Styled Components
+ ISTF Prototype

W3C CSS Spec

πŸ‘ͺ

Interoperable

Publish with X,

use with Y

πŸ’…
StyleΒ 

CSS

CSSinJS

πŸš€
T
ransfer

Compact

Fast

🎰
F
ormat

For Machines,
not Humans

Performance

Interoperability

Dynamic features
Cross-platform

Β 

The Goal

Thanks!

UVP of CSSinJS Frameworksdays

By Oleg Isonen

UVP of CSSinJS Frameworksdays

  • 2,235