Skip to content

Instantly share code, notes, and snippets.

@alberteddu
alberteddu / copy-attachments.js
Created January 15, 2021 10:39
Server and copy attachments
// util/copy-attachments.js
// This is supposed to copy all files to the url where next.js expects them as a static file.
// The example I have is too tailored to my library to make any sense to anyone else.
// However, the theory is: static file is expected at /some/url/hey.png
// When running next.js in dev, server.js will serve this url instead, because this file is not in
// the public folder, but is instead in the content folder I manage.
// When building, I run this script (see package.json example below) which will move hey.png
// to public/some/url/hey.png.