diff options
author | Jeremy Rifkin <51220084+jeremy-rifkin@users.noreply.github.com> | 2022-06-12 08:29:52 -0400 |
---|---|---|
committer | Jeremy Rifkin <51220084+jeremy-rifkin@users.noreply.github.com> | 2022-06-12 08:29:52 -0400 |
commit | 45bff8f1bb817b699356afbbac0fe037eaf8594c (patch) | |
tree | 1d63dcf8158169c022ef159f2b71f64e79963775 | |
parent | 306acc0f67890184cffbc65a0a383f01187c0155 (diff) | |
download | compiler-explorer-gh-3309.tar.gz compiler-explorer-gh-3309.zip |
Added doc for adding site templatesgh-3309
-rw-r--r-- | docs/AddingASiteTemplate.md | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/docs/AddingASiteTemplate.md b/docs/AddingASiteTemplate.md new file mode 100644 index 000000000..ecdba883a --- /dev/null +++ b/docs/AddingASiteTemplate.md @@ -0,0 +1,31 @@ +# Adding a new site template + +Site templates are configured in [`etc/config/site-templates.conf`](../etc/config/site-templates.conf). + +The configuration format is `Template Name=Godbolt.org full link`. + +To create a site template: + +- Setup the template on [https://godbolt.org](https://godbolt.org) +- Export with a full link from the "Share" dropdown in the top-right corner of the page +- Add to the config file + +## Screenshot generation + +Below are instructions to generate site templates. Because it's a bit hacky feel free to not run the script, we can do +so when a PR is made. + +Site template screenshots are generated with a hacky script located at +[`etc/scripts/generate_site_template_screenshots.js`](../etc/scripts/generate_site_template_screenshots.js). + +To run the script, `cd` to the `etc/scripts/` directory and run + +```bash +npm i puppeteer --no-save && node generate_site_template_screenshots.js +``` + +The script uses puppeteer and chrome to generate screenshots. The script will take a little while to run as it generates +multiple screenshots per template and gives pages ample time to load. + +Screenshots are located in [`views/resources/template_screenshots/`](../views/resources/template_screenshots/). The +script won't regenerate everything by default, to regenerate delete the screenshot images you want deleted. |