0.9.2 • Published 1 year ago

@morfeo/css v0.9.2

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

@morfeo/css

Morfeo logo

@morfeo/css zero run-time usage of morfeo


Documentation | API | Contributing | Discord


Installation

# With npm
npm install @morfeo/css

# With yarn
yarn add @morfeo/css

Then, depending on your stack, you'll need to install another package in order to enabling the build-time behavior:

Nextjs

# With npm
npm install @morfeo/next

# With yarn
yarn add @morfeo/next

Others

# With npm
npm install @morfeo/compiler

# With yarn
yarn add @morfeo/compiler

Usage

Example in React

createUseStyle

import { createUseStyle } from "@morfeo/css"

const useStyle = createUseStyle({
  p: 'm',
  bg: 'background',
  corner: 's',
});


function MyComponent() {
  const { className } = useStyle();
  return (
    <div className={className}>
      <h1>Hello world!</h1>
    </div>
  )
}

This will be replaced at build-time into something like:

import { createUseStyle } from "@morfeo/css"

const useStyle = () => ({
  className: 'p-m bg-background corner-s',
  style: {},
});


function MyComponent() {
  const className = useStyle();
  return (
    <div className={className}>
      <h1>Hello world!</h1>
    </div>
  )
}

And also the related css will be generated:

.p-m {
  padding: 1rem;
}
.bg-background {
  background-color: #ffffff;
}
.corner-s {
  border-radius: 12px;
}
0.9.0

1 year ago

0.9.2

1 year ago

0.9.1

1 year ago

0.8.0

1 year ago