πŸ’ Plumeria

Introduction

Welcome to the Plumeria documentation!


What is Plumeria?

Plumeria is a high-performance CSS-in-JS library designed for speed, scalability, and efficient styling in modern JavaScript and TypeScript projects.

Reusability and readability through abstraction of style definitions, Developers can focus on what to apply styles to, rather than how to apply them. It designed for Vite and Next.js and is optimized for React.

The CSS Module Problem

CSS Modules have many advantages - but lack type safety. Therefore making it difficult to detect class name errors and refactor styles safely.

[CSS Modules]
──────────────────────────────────────────────────────────
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ Component            β”‚  ← CSS Module is imported in a JSX file  
β”‚ (JSX importing)      β”‚     (e.g., `import styles from './button.module.css'`)  
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
            β”‚
            β”‚  CSS is written in an external file
            β–Ό
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ CSS File (.module.css) β”‚  ← Styles are statically defined  
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
            β”‚
            β”‚  β€» The bundler (e.g., Webpack) processes  
            β”‚     and hashes class names at build time  
            β–Ό
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ Build Process (Webpack) β”‚  ← Class names are determined during build  
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
            β”‚
            β–Ό
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ Generated CSS Output β”‚  ← Hashed class names are output  
β”‚ (Only visible after  β”‚     β€» The final result is unknown until build  
β”‚ building)            β”‚  
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

It has the characteristic that the final output result is not known until the build is completed.
The feedback loop needs to the shortest so developers can deliver high-quality code quickly.

The CSS in JS solution

A feature of Plumeria is that the compilation process is independent from the development flow.

[CSS in JS (Plumeria)]
──────────────────────────────────────────────────────────
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”       β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ Component            │───1──▢│ CLI Command Execution   β”‚
β”‚ (JSX with CSS in JS) β”‚       β”‚ (Precompilation)        β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜       β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
     β–²         β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”           β”‚
     β”‚         β”‚ Generated CSS File      β”‚           β”‚
   3 └─────────│ (Static CSS available)  β”‚ β—€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ 2
               β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β€» The final result is known at this time
                  β”‚
                4 β”‚
                  β”‚  β€» The following process happens in production builds  
                  β–Ό
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ Production Build Process      β”‚  ← e.g., Webpack, Vite  
β”‚ (Tree-shaking & Minification) β”‚     β€» Removes used styles  
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Plumeria solves the problem of debugging CSS through a CLI. By allowing you to quickly cycle through the feedback loop of write,compile,test,write,compile,test you can drastically reduce the time you spend debugging.

On this page