og-image/CONTRIBUTING.md

22 lines
1.4 KiB
Markdown
Raw Permalink Normal View History

2019-02-05 16:28:43 +00:00
# Contributing
2022-03-15 23:00:37 +00:00
There are three pieces to `og-image` that are worth noting before you begin development.
2019-02-05 16:28:43 +00:00
2020-08-11 19:53:00 +00:00
1. The backend image generator located in [/api/index.ts](https://github.com/vercel/og-image/blob/main/api/index.ts)
2021-12-20 17:54:09 +00:00
2. The html/css template used to generate the image is located in [/_lib/template.ts](https://github.com/vercel/og-image/blob/main/api/_lib/template.ts)
3. The frontend inputs located in [/web/index.ts](https://github.com/vercel/og-image/blob/main/web/index.ts)
2019-02-05 16:28:43 +00:00
2020-10-09 16:59:01 +00:00
Vercel handles [routing](https://github.com/vercel/og-image/blob/main/vercel.json#L6) in an elegant way for us so deployment is easy.
2019-02-05 16:28:43 +00:00
To start hacking, do the following:
2019-02-05 16:28:43 +00:00
1. Clone this repo with `git clone https://github.com/vercel/og-image`
2. Change directory with `cd og-image`
3. Run `yarn` or `npm install` to install all dependencies
4. Run locally with `vercel dev` and visit [localhost:3000](http://localhost:3000) (if nothing happens, run `npm install -g vercel`)
2020-08-11 19:53:00 +00:00
5. If necessary, edit the `exePath` in [options.ts](https://github.com/vercel/og-image/blob/main/api/_lib/options.ts) to point to your local Chrome executable
2019-02-05 16:28:43 +00:00
Now you're ready to start local development!
You can set an environment variable to assist with debugging `export OG_HTML_DEBUG=1`. This will render the image as HTML so you can play around with your browser's dev tools before committing changes to the template.