https://github.com/reminjp/cardboard
:construction: A command line tool to generate cards.
https://github.com/reminjp/cardboard
Last synced: about 2 months ago
JSON representation
:construction: A command line tool to generate cards.
- Host: GitHub
- URL: https://github.com/reminjp/cardboard
- Owner: reminjp
- Created: 2023-08-02T14:11:46.000Z (about 2 years ago)
- Default Branch: master
- Last Pushed: 2025-02-19T06:05:33.000Z (8 months ago)
- Last Synced: 2025-02-19T07:22:12.515Z (8 months ago)
- Language: TypeScript
- Homepage:
- Size: 78.1 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
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:
- Node.js or Bun
- fontconfig (`fc-list` command)
Install:
```sh
bun install --global github:reminjp/cardboard#npm
```
Uninstall:
```sh
bun uninstall --global github:reminjp/cardboard#npm
```
## 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