0

For example, I have an index.html for the project.

I'd like that whenever I build the project, it's automatically copied to the public project. Is there a built-in way to achieve this?

Lyhokia
  • 73
  • 1
  • 3
  • We need more information about your project (please provide at least the parts of the file system tree, that are relevant to the problem) and how you serve the files. E.g. you can tell the test-server from shadow to look for files in different locations - but this is all just guessing right now. – cfrick Jul 16 '21 at 05:50

1 Answers1

5

There is a built-in hook to copy (and potentially modify) a HTML file.

In can be configured in your build config via

:build-hooks
[(shadow.html/copy-file "src/html/index.html" "public/index.html")]

All paths are relative to the project root. This only copies that specified file, nothing else. You could write your own hook to copy more or just use a separate command to copy the files manually.

I typically just put all the files in their "final" place from the start and just have a public/js folder or so that is git-ignored that I can delete and will be recreated when I build my CLJS. That way there is no need to copy anything to begin with. ;)

Thomas Heller
  • 3,842
  • 1
  • 9
  • 9