Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/econify/moonshine-css

🥃 High-proof atomic CSS framework
https://github.com/econify/moonshine-css

atomic-css css-in-js rust-lang styled-components styled-system utility-classes

Last synced: 3 months ago
JSON representation

🥃 High-proof atomic CSS framework

Awesome Lists containing this project

README

        

# Moonshine CSS

![](./docs/logo.svg)

## Features

- 🥃 Minimal and simple atomic CSS framework
- ⚗️ 100% customizable - build your own CSS framework
- 🦀 Blazing fast generator written in Rust
- 🐜 Tiny `1.7 kB` runtime
- ⚛️ CSS-in-JS library for React

## Install

```bash
npm install --save @econify/moonshine-css
yarn add @econify/moonshine-css
```

## Generate Styles

Create a `.moonshinerc` file in your project root.

by running

```
npx distill --init
```

or by creating a file manually:

```json
{
"options": {
"atomStyle": "classAttribute",
"breakpointModifierStyle": "suffix",
"breakpointModifierSeperator": "-",
"breakpoints": {
"sm": { "minWidth": "576px" },
"md": { "minWidth": "768px", "maxWidth": "992px" },
"lg": { "minWidth": "992px" }
},
"pseudoClasses": {
"hov": ":hover"
}
},
"designTokens": ["./atomic-design-tokens.yml"],
"templates": [
"./tachyons-border-box.yml",
"./tachyons-colors.yml",
"./tachyons-flex.yml",
"./tachyons-spacing.yml"
],
"output": {
"cssVariables": "./dist/variables.css",
"cssAtoms": "./dist/atoms.css",
"jsonAtoms": "./dist/atoms.json"
}
}
```

then run

```bash
npx distill --watch
```

## Usage

```js
import "atomic-styles.css";
```

```js
import { styled } from "@econify/moonshine-css";

const Button = styled.button(
"bg-blue-500 hover:bg-blue-700 text-white font-bold py-2 px-4 rounded",
({ isPrimary }) => isPrimary && "bg-primary text-white"
);

export default Demo() {
return (


Click me

);
};
```

You can read more about the [runtime syntax here](./docs/RUNTIME.md).

## Acknowledgements

TBD