Git Product home page Git Product logo

glam's Introduction

glam

[work in progress]

β€œIt's like giving a glass of ice water to somebody in hell"

yarn add glam or npm install glam

// copy paste this at the top of your file
/* @jsx glam */
import glam from 'glam'

// and then write css as inline objects

<div css={{
  color: 'red',
  ':hover': {
    color: 'blue'
  }
}}>
  hello world!
</div>

motivation

I made it for me. You might like it. It's the core experience of glamor, trimmed down and optimised for react.

  • fast, small
  • great for prototyping / design systems
  • objects everywhere
  • compose with arrays
  • easy to migrate to/from another system

object format

  • key: value
  • key : [...fallbacks]
  • <selector> : {...}
  • @media <query>: {...}
  • @supports: {...}
  • nest it however you want
  • (todo) @keyframes: {...}
  • (todo) @font-face: {...}

composition

  • objects everywhere
  • nested selectors
  • arrays to join efficiently
  • whatever pattern you want on top - bem, itcss, oocss, sc, jsxstyle, whatever

debugging / tools / dx

[todo]

tradeoffs

  • memory - glam maintains a hierarchical WeakMap cache for the parser, and a Set of inserted ids.
  • runtime - about 8k gz
  • added bundle size of having your styles as objects
  • learning curve

how does it work?

[todo]

how is it different

  • typed
  • streaming ssr support
  • (todo) iframes
  • (todo) wc (via skate?)
  • (todo) safe

server rendering

glam should 'just work' with react v16, streaming and all.

[todo] - when hydrating on the client side, use glam/hydrate.

[todo - v15 shim]

[maybe?]

  • global
  • react-native/ vr
  • static extraction
  • scoped
  • 'virtual'
  • parser/generator plugins
  • houdini
  • reset.css

glam's People

Contributors

threepointone avatar ooade avatar mbasso avatar tuchk4 avatar emmatown avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.