0.3.9 ā€¢ Published 1 year ago

@cfuen/twimba v0.3.9

Weekly downloads
-
License
MIT
Repository
-
Last release
1 year ago

twimba

A small (4kb min + gzip) macro that converts inline Imba CSS into Vanilla CSS.


It can be used at runtime like Twind or it can be used internally by your build scripts. All the same, it's Imba CSS-in-your-JS!

Getting Started

Before anything, you'll have to add Twimba to your project

npm install @cfuen/twimba
yarn install @cfuen/twimba
pnpm install @cfuen/twimba

The most basic way to use Twimba is to use Vanilla JS and alter the DOM with it.

import { twimba } from '@cfuen/twimba'

const div = document.createElement("div");
div.innerText = "Twimba is kinda cool";
div.style = twimba`fs:sm rd:md px:5 py:2 bg:cyan4 c:white`
document.body.appendChild(div);

šŸŽÆ Changelog

  • Jan 19, 2023: Twimba v.0.3.0, Size and easing shorthands!

    • Feb 3, 2023: 0.3.1

      • fix default value for unspecified size units being 1px instead of 0.25rem.
      • fix issue #1: font-weight's value being parsed as a size value (And therefore getting transformed to px/rem).
    • Apr 20, 2023: 0.3.5

      • fix issue #2: Three-letter shorthands like ead and eaf not being correctly transpiled.
      • fix YET ANOTHER PROBLEM from #2: Two-letter shorthands for easing properties (Such as ea and eb) not being correctly transpiled.
      • do not ask why the sudden jump to 0.3.5, I suck at managing npm packages
    • Apr 20, 2023: 0.3.9

      • fix issue #3: Fix normal css properties breaking the Imba code parsing process (ie. Writing background as opposed to bg).
      • do not ask why the sudden jump to 0.3.9, I FORGOT TO TEST THROUGHOUTLY BEFORE RELEASE I'M SORRY (and I still suck at managing npm package versions)
  • Jan 19, 2023: Twimba v.0.2.0, various orders of magnitude faster than v0.1 and supports colors.

    • Jan 21, 2023: 0.2.1
      • fix custom properties not being generated properly.
      • fix numeric values without a unit not being appended with "px".
      • add simple build script for contributors (And for my mental health).
  • Jan 18, 2023: Twimba v.0.1.0, a.k.a initial alpha release. This is far from stable.

āœØ Features

  • CSS shorthands (ie. bgc => background-color)

  • Custom properties (ie. px => padding-x => padding-left; pading-right;)

  • Colors (ie. teal6, red2)

  • Sizes (ie. xxs, md, xl3)

  • Custom Units

šŸ’Ŗ Advantages & Drawbacks

šŸ”„ Zero config

Get some of the benefits of Imba's CSS without the need for... Imba, Vite, or anything really.

šŸ› ļø Framework agnostic

Bring Twimba to your favorite tool! Works with anything, even SSR.

āœ”ļø Nice, cheap and pretty

Twimba ships a macro for inline styles, not CSS.

šŸ”’ Limited, thought

Inline styles means no pseudo-selectors, but you still get an awesome syntax and some palettes.

This could change in the future, but for now this is all you get.

šŸŽ¬ Credits

Inspirations

  • Imba: The JavaScript-targeting fullstack language that defines the beautiful CSS syntax Twimba compiles to. Currently my favorite take on CSS abstractions (And web language abstractions in general).
  • twind: A small compiler that converts TailwindCSS's utility classes into CSS at runtime.
  • Tailwind CSS: The paradigm-shifting standard that spawned the need for CSS-In-JS solutions like Twind and inspired Imba's CSS syntax.
  • Marko: A superset of HTML and SSR framework that made me want to write a CSR "petite" version of an already stablished language standard. The first time I ever fell in love with a web language abstraction.
  • goober: An insanely small CSS-In-JS solution that really made me appreciate and admire lightweight packages.
  • little-vdom: An insanely small JSX solution that convinced me we can have nice things packaged in a small bundle.

šŸ˜ˆ Where I stole some of the README structure from

Twind's GitHub README

0.3.9

1 year ago

0.3.6

1 year ago

0.3.5

1 year ago

0.3.8

1 year ago

0.3.7

1 year ago

0.3.2

1 year ago

0.3.4

1 year ago

0.3.3

1 year ago

0.3.1

1 year ago

0.3.0

1 year ago