Skip to content

developer-1px/adorable-css

Repository files navigation

AdorableCSS

Rapid On-Demand Atomic CSS framework AdorableCSS๋ฅผ ๋งŒ๋“ค๊ฒŒ ๋œ ๋ฐฐ๊ฒฝ์ด ๊ถ๊ธˆํ•˜๋‹ค๋ฉด ์—ฌ๊ธฐ๋ฅผ ํ†ตํ•ด ํ™•์ธํ•ด๋ณด์„ธ์š”.

Try It Online

  • Try it online here.

AdorableCSS

Don't write your own css. Just write down in HTML.

// Button.tsx

export const Button = () =>
  <button class="hbox pack gap(6) bg(#333) c(#fff) b(#000.2) r(6) p(8/12) font(14/16/-1%) bold pointer transition(.2s)
  hover:bg(#555)
  active:bg(#000)! active:b(#000.2)">
    <div>๐Ÿ‘</div>
    <div>Like</div>
  </button>

... and auto generate css on realtime! ๐Ÿ˜Ž

/* @adorable.css */

* {margin:0;padding:0;box-sizing:border-box;font:inherit;color:inherit;flex-shrink:0;}
.c\(\#fff\){color:#fff;}
html .active\:bg\(\#000\)\!:active,html .active\:bg\(\#000\)\!.\:active{background-color:#000!important;}
.bg\(\#333\){background-color:#333;}
@media (hover:hover){.hover\:bg\(\#555\):hover,.hover\:bg\(\#555\).\:hover{background-color:#555;}}
.font\(14\/16\/-1\%\){font-size:14px;line-height:16px;letter-spacing:-0.01em}
.bold{font-weight:700;}
.hbox{display:flex;flex-flow:row;align-items: center;}
.p\(8\/12\){padding:8px 12px;}
.pack{display:flex;align-items:center;justify-content:center;}
.pointer{cursor:pointer;}
html .active\:b\(\#000\.2\):active,html .active\:b\(\#000\.2\).\:active{border:1px solid rgba(0,0,0,.2);}
.b\(\#000\.2\){border:1px solid rgba(0,0,0,.2);}
.r\(6\){border-radius:6px;}
.gap\(6\){gap:6px;}
.layer{position:absolute;top:0;right:0;bottom:0;left:0}
.transition\(\.2s\){transition:all .2s;}

Getting Started

CDN

  • โ›ฑ vite, webpack, postcss๋“ฑ ๋‹ค๋ฅธ ๋ณต์žกํ•œ ์„ค์ • ์—†์ด ๊ทธ๋ƒฅ script ํ•œ์ค„๋งŒ ์ถ”๊ฐ€ํ•˜๋ฉด adorableCSS๋ฅผ ์‚ฌ์šฉํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.
  • โšก๏ธ adorableCSS๋ฅผ ๊ฐ„ํŽธํ•˜๊ฒŒ ์“ฐ๋Š” ๋ฐฉ๋ฒ•! body ๋งจ ์•„๋ž˜ <script src="https://unpkg.com/adorable-css"></script>๋งŒ ์ถ”๊ฐ€ํ•ด๋ณด์„ธ์š”.
  • ๋Ÿฐํƒ€์ž„ ๋ฐฉ์‹์œผ๋กœ css in js ๋ฐฉ์‹์„ ํ†ตํ•ด์„œ ๋™์ ์œผ๋กœ style์„ ์ƒ์„ฑํ•˜์—ฌ ์ ์šฉํ•ด์ค๋‹ˆ๋‹ค.
  • (์ง€๊ธˆ ๊ฐœ๋ฐœ์ž ๋„๊ตฌ๋ฅผ ์—ด์–ด์„œ ์•„๋ฌด ์—˜๋ฆฌ๋จผํŠธ๋‚˜ class="bg(red)" ๋ฅผ ํ•œ๋ฒˆ ์ถ”๊ฐ€ํ•ด๋ณด์„ธ์š”.)
  <script src="https://unpkg.com/adorable-css"></script>
</body>
</html>

Vite(Recommended)

  • run-time์ด ์•„๋‹ˆ๋ผ Build-time์—์„œ ์ตœ์ข… css๋ฅผ ๋งŒ๋“ค์–ด๋ƒ…๋‹ˆ๋‹ค. (zero run-time)
  • ์ตœ์ข…์ ์œผ๋กœ ๋งŒ๋“ค์–ด์ง„ css๋ฅผ ํ†ตํ•ด์„œ ๋Ÿฐํƒ€์ž„ ๋น„์šฉ์„ ๋” ์ค„์ผ ์ˆ˜ ์žˆ๊ณ  css์˜ ์บ์‹ฑ ๊ธฐ๋Šฅ์„ ๋” ํ™œ์šฉํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.
npm i -D adorable-css
// vite.config.js
import {adorableCSS} from "adorable-css/vite" // <-

export default defineConfig({
  plugins: [adorableCSS(), ...] // <- plugin์„ ๋งจ ์ฒ˜์Œ์— ๋“ฑ๋กํ•ฉ๋‹ˆ๋‹ค.
})
// main.tsx
import "@adorable.css" // <- virtual css๋ฅผ import ํ•ฉ๋‹ˆ๋‹ค.

import React from "react"
import ReactDOM from "react-dom"
import "./index.css"
import {App} from "./App"

ReactDOM.render(
  <React.StrictMode>
    <App/>
  </React.StrictMode>,
  document.getElementById("root")
)

React, Svelte, Vue ... Almost Web framework support with Vite.

CLI(beta): Build Time + Watch mode

Remix + adorable css example

npm i -D adorable-css
Usage:
  $ adorable-css [root]

Commands:
  [root]  build for production

For more info, run any command with the `--help` flag:
  $ adorable-css --help

Options:
  -o, --out <dir>  [string] output Directory (default: adorable.css)
  -w, --watch      [boolean] rebuilds when modules have changed on disk (default: false)
  -m, --minify     [boolean] minify output css (default: false)
  -v, --verbose    [boolean] verbose build output (default: false)
  --no-reset       [boolean] exclude reset css from output (default: true)

vite ํ™˜๊ฒฝ์ด ์•„๋‹ˆ๋ผ๋ฉด cdn์„ ํ†ตํ•ด์„œ ์‹ค์‹œ๊ฐ„์œผ๋กœ ๊ฐœ๋ฐœํ•˜๊ณ  cli๋กœ ์ตœ์ข… ๋นŒ๋“œ์‹œ css๋งŒ ํฌํ•จํ•˜๋Š” ๋ฐฉ์‹์„ ์ƒ๊ฐํ•˜๊ณ  ์žˆ์Šต๋‹ˆ๋‹ค. ๋‹ค์–‘ํ•œ ํ™˜๊ฒฝ์—์„œ ์กฐ๊ธˆ๋” DX๋ฅผ ๋†’์ด๋Š” ๋ฐฉํ–ฅ์„ฑ์„ ๊ณ ๋ฏผํ•ด๋ณด๊ฒ ์Šต๋‹ˆ๋‹ค.


What is AdorableCSS?

Rapid On-Demand Atomic CSS framework

๊ณจ์น˜์•„ํ”ˆ css ์ด๋ฆ„์ง“๊ธฐ๋Š” ์ด์ œ ๊ทธ๋งŒ!

๋” ์ด์ƒ ์ƒˆ๋กœ์šด css๋ฅผ ์ž‘์„ฑํ•˜๋Š” ๋ฐ ํž˜๋นผ์ง€ ๋งˆ์„ธ์š”. ๊ฑฐ์˜ ๋ชจ๋“  class๋ฅผ ๋ฏธ๋ฆฌ ์ •์˜ํ•ด๋‘์—ˆ์Šต๋‹ˆ๋‹ค.

class="font(20) c(red)"์™€ ๊ฐ™์ด ํ•จ์ˆ˜ํ˜•์œผ๋กœ ์ •์˜๋œ ํ˜•์‹์œผ๋กœ ์ž…๋ ฅํ•ด๋ณด์„ธ์š”.

๋ชจ๋“  ์ˆ˜์น˜์™€ ์ƒ‰์ƒ์„ ์ง€์›ํ•˜๋ฉฐ, ํ•„์š”ํ•œ ๋งŒํผ์˜ CSS๋งŒ ๋งŒ๋“ค์–ด ๋ƒ…๋‹ˆ๋‹ค.

Why Use AdorableCSS?

Easy! : ๋””์ž์ธ ๊ฐœ๋ฐœ์„ ์œ„ํ•ด ์ด๋ฆ„์„ ์ง“๋Š” ์ˆ˜๊ณ ๊ฐ€ ์‚ฌ๋ผ์ง€๋ฉฐ, ํ•œ๋ฒˆ ์™ธ์šด ์ด๋ฆ„์€ ๊ณ„์† ์‚ฌ์šฉํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

Write less do more! : ๊ธฐ์กด css๋ฌธ๋ฒ•๋ณด๋‹ค ํ›จ์”ฌ ๋” ์ ์€ ์ฝ”๋“œ๋กœ ๋” ๋งŽ์€ ์ž‘์—…์„ ํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

Fast Writing and No switching! : html, jsx์— ๋ฐ”๋กœ ๋””์ž์ธ์„ ์ ์šฉํ•  ์ˆ˜ ์žˆ์–ด ๋งค์šฐ ๋น ๋ฅธ ๋””์ž์ธ ๊ฐœ๋ฐœ ์†๋„๋ฅผ ๊ฐ€์ง‘๋‹ˆ๋‹ค.

Portable! : css ์—†์ด HTML๋งŒ์œผ๋กœ UI๋ฅผ ๋งŒ๋“ค ์ˆ˜ ์žˆ์–ด ์ด๋™๊ณผ ๋ฆฌํŒฉํ† ๋ง์—์„œ ์ž์œ ๋กญ์Šต๋‹ˆ๋‹ค.

Compact! : ๊ธฐ์กด css ๋ฐฉ์‹๋ณด๋‹ค ํ›จ์”ฌ ๋” ์ ์€ ๋ผ์ธ์˜ ์ตœ์ ํ™”๋œ css๋ฅผ ์ƒ์‚ฐํ•ฉ๋‹ˆ๋‹ค.

Great for Auto Design HandOff! : ์ด๋ฆ„์ด ํ•„์š”์—†๊ธฐ์— figma๋“ฑ์˜ HandOff์—์„œ ๋ณ€ํ™˜ํ•˜๊ธฐ์— ์ตœ์ ํ™”๋œ ํ˜•ํƒœ์ž…๋‹ˆ๋‹ค.

Handshake

figma AdorableCSS plugin link

Documentation

For full documentation, visit here.