2022-03-12 01:34:09 -08:00
|
|
|
# Omorphia
|
2022-03-07 21:55:31 -08:00
|
|
|
|
2022-05-20 00:10:15 -07:00
|
|
|
_The Modrinth component library, in Svelte_
|
2022-03-07 21:55:31 -08:00
|
|
|
|
2022-03-09 21:27:53 -08:00
|
|
|
---
|
2022-03-07 21:55:31 -08:00
|
|
|
|
2022-05-20 19:53:13 -07:00
|
|
|
Read the documentation at [omorphia.modrinth.com.](https://omorphia.modrinth.com)
|
2022-03-07 21:55:31 -08:00
|
|
|
|
2022-05-20 00:10:15 -07:00
|
|
|
Requires Node v16.5+.
|
|
|
|
|
|
2022-03-09 21:27:53 -08:00
|
|
|
## Developing
|
2022-03-07 21:55:31 -08:00
|
|
|
|
2022-06-17 19:58:01 -07:00
|
|
|
The library lives in the `package/` folder, and the documentation lives in the `docs/` folder.
|
2022-03-07 21:55:31 -08:00
|
|
|
|
|
|
|
|
```bash
|
2022-03-09 21:27:53 -08:00
|
|
|
pnpm install # Install dependencies
|
|
|
|
|
pnpm dev # Run dev server
|
2022-03-07 21:55:31 -08:00
|
|
|
```
|
|
|
|
|
|
2022-06-13 11:34:46 -07:00
|
|
|
### Adding new components
|
|
|
|
|
|
|
|
|
|
> Replace `ComponentName` with your component name in the steps below
|
|
|
|
|
|
2022-06-18 15:40:17 -07:00
|
|
|
1. Create a `ComponentName.svelte` file in `src/components`
|
|
|
|
|
2. Add an export for your component in [./src/index.ts](./src/index.ts)
|
2022-06-13 11:34:46 -07:00
|
|
|
```
|
|
|
|
|
export { default as ComponentName } from './components/ComponentName.svelte'
|
|
|
|
|
```
|
2022-06-17 19:58:01 -07:00
|
|
|
3. Create a `ComponentName.md` file for documentation in `docs/routes/components`
|
2022-06-13 11:34:46 -07:00
|
|
|
4. Add an example of your component in your `ComponentName.md` file, like so:
|
|
|
|
|
|
|
|
|
|
````md
|
|
|
|
|
```svelte example raised
|
|
|
|
|
<script lang="ts">
|
|
|
|
|
import { ComponentName } from 'omorphia'
|
|
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
<ComponentName />
|
|
|
|
|
```
|
|
|
|
|
````
|
|
|
|
|
|
2022-03-09 21:27:53 -08:00
|
|
|
## Packaging
|
2022-03-07 21:55:31 -08:00
|
|
|
|
2022-03-09 21:27:53 -08:00
|
|
|
```bash
|
|
|
|
|
pnpm package
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
## Building
|
|
|
|
|
|
|
|
|
|
To build the documentation site, run:
|
|
|
|
|
|
|
|
|
|
```bash
|
|
|
|
|
pnpm build
|
2022-05-20 00:10:15 -07:00
|
|
|
```
|