I would like to exclude folders from my static folders from being copied. Is there a good way to do this?
Specifically:
My static directories have “.git” subdirectories. (There is a complicated arrangement of submodules, so I can’t avoid this). I do not want the “.git” directory copied during the build process.
But… how does this interact with multiple static directories (if I add those lines to my config.toml, I don’t get the 2nd directory).
Context…
At the top of my config.toml, I have the lines:
staticDir = “static”
staticDir2 = “…/common/CS559-Lib”
I have to do this, because we use switching to switch the static directory based on the command line arguments. (a second toml file over-writes “staticDir” to point towards an alternate directory. We use this to generate both the assignment and the answer key for students).
It seems that with the module.mounts above, the 2nd staticDir is ignored.
Thank you! This is helpful. I wasn’t aware of mounts. (and I haven’t really learned about modules yet)
In reading up on this, there are two things that (I think) are incompatible with what I am doing:
it would be really hard to do absolute paths (many people build these on different machines)
I need to be able to over-ride the first directory “later” in the config file (technically, a second config file is read that over-writes the staticDir variable - we use this to switch configurations at the command line)
Basically, we do hugo to build the assignments and hugo --config=config.toml,config-solution.toml to generate the answer key (the “config-solution.toml” changes staticDir to include the answers, rather than the empty questions).
Module mounts seem better than the “staticDir” - but if I cannot workaround 1 and 2, it might be a non-starter.
More context:
I am using Hugo to generate weekly workbooks for an undergraduate computer graphics class. Each “workbook” is a mini website (built in Hugo), with some embedded pages with JavaScript programs on them (large numbers of static files as far as Hugo is concerned). Some of those JavaScript programs are the empty “starter code” for the student assignments. (others are demos we give the students)
What I have is a tangled mess where there is 1 GitHub Repository with 12 “workbooks”. Each workbook has 2 versions of a static directory with the programs that students write - one has the empty starter code, the other has the example solutions. Each workbook also includes (as static files) a bunch of JavaScript libraries required to run the code.
Some of those libraries are included in the overall repository as git submodules - which is why they have .git that gets copied over (the point of the question). Right now, I delete them manually.