Ecosyste.ms: Awesome

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

Awesome Lists | Featured Topics | Projects

https://github.com/reminjp/cardboard

:construction: A command line tool to generate cards.
https://github.com/reminjp/cardboard

Last synced: about 1 month ago
JSON representation

:construction: A command line tool to generate cards.

Awesome Lists containing this project

README

        

# Cardboard

**This tool is still experimental.
Not ready to accept feature requests and pull requests.**

A command line tool to generate cards.
It reads a card design template (JSX) and tabular data (CSV or Google Sheets) and outputs documents for desktop publishing (PDF).

カードを生成するコマンドラインツール。
カードデザインのテンプレート(JSX)と表形式のデータ(CSVまたはGoogleスプレッドシート)を読み込んで印刷用の原稿(PDF)を出力します。

## Installation

Requirements:

- [Deno](https://deno.com/)
- fontconfig (`fc-list` command)

Install:

```sh
deno install --allow-env --allow-net --allow-read --allow-run --allow-write --force --name cardboard https://raw.githubusercontent.com/reminjp/cardboard/master/mod.ts
```

Install (shortened):

```sh
deno install -Af -n cardboard https://raw.githubusercontent.com/reminjp/cardboard/master/mod.ts
```

## Usage

Create a project root directory.
Place `cardboard.toml` and other resources in there.
Run `build` command in the project root directory:

```sh
cardboard build
```

### Examples

- [Card game](./examples/card_game)

### Project structure

#### cardboard.toml

**`cardboard.toml`** is a Cardboard project file.
It defines build **targets**, which specify references to **tables** and **templates**:

```toml
[[targets]]
name = "card_front"
table = "card"
template = "card_front"

[[tables]]
name = "card"
path = "./card.csv"

[[templates]]
name = "card_front"
path = "./card_front.jsx"
width = "63mm"
height = "88mm"
```

#### Tables

Each row of a table represents parameters for a single card.
This tool accepts a CSV file or a reference to Google Sheets as an input source.

#### Templates

A template is an JSX file that designs one type of card.
It supports a limited subset of HTML and CSS features.

- Layout
- Features supported by [Satori](https://github.com/vercel/satori) (e.g. margin, position, size, flex)
- Background color, text color
- CMYK (`cmyk(0% 0% 0% 100%)`)
- RGB (`#000000`)
- Image
- PDF (``)

This tool uses [Satori](https://github.com/vercel/satori) internally to convert HTML to intermediate SVG.
Its documentation may be helpful for troubleshooting.
For example, you can specify a locale via the `lang` attribute:

```html

海角骨刃直入

```

## Author

Remin