Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
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.
- Host: GitHub
- URL: https://github.com/reminjp/cardboard
- Owner: reminjp
- Created: 2023-08-02T14:11:46.000Z (over 1 year ago)
- Default Branch: master
- Last Pushed: 2023-12-08T09:39:27.000Z (about 1 year ago)
- Last Synced: 2024-05-01T15:53:34.380Z (8 months ago)
- Language: TypeScript
- Homepage:
- Size: 471 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:
- [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