nixos-homepage icon indicating copy to clipboard operation
nixos-homepage copied to clipboard

separate source files and build artifacts

Open cko opened this issue 8 years ago • 7 comments

Atm the build outputs are stored in the same directory as the source files e.g. nixos-homepage/nixos/options.tt (source) and nixos-homepage/nixos/options.html (build output). Then everything seems to be deployed to the live website e.g. http://nixos.org/nixos/options.html and http://nixos.org/nixos/options.tt It would be nicer to have a directory like build where all build artifacts are stored. This would also simplify the .gitignore file and prevent accidental commits of generated files.

cko avatar Oct 08 '16 18:10 cko

I've looked it this make file, it's not as simple as it seems, Make is being used as it was intended, it's tracking the resultant .html files, if there are no change, and the .html files exist, nothing is built!!!..... I presume this was something to do with the neat

[nix-shell]$ fd | entr make

where as any modification to file in the directory, would trigger a rebuild, but only what needs to be rebuilt. It's really a beautiful optimal build system.

if you try repath the output from tpage, then it works, but you end up with make file that constantly builds the page as it can't track the relocated html files.

If this really is an issue, then maybe make should copy of build file to some output directory, and that can be served by the web server???

nixinator avatar Jun 18 '20 20:06 nixinator

@nixinator the idea is to have all website related files (html/css/js/...) being created in some other folder (eg. ./build) and when deploying I will only sync this folder to netlify. Then all the other things will just continue to work. Makes sense?

garbas avatar Jun 19 '20 06:06 garbas

Sure, I'll send you a PR.

nixinator avatar Jun 19 '20 07:06 nixinator

@nixinator also maybe work on top of #454 since removes some resources and we can already avoid conflicts this way.

garbas avatar Jun 19 '20 08:06 garbas

Ok, i'll take a look at that. I can modify the make file to do a build in place as it works now, and then mv all the artefacts to build/ directory. However, the way 'make' works, it's not great at tracking when files have been moved with mv. If make cant't track these, it can't do conditional rebuilds based on files changing.

The make file builds the website in place as I suspect tools like xsltproc can play havock with relative and absolute paths when processing, so it builds it in the root. Maybe the best course of action is that everything that is created in a .tmp , gets copied to a build/. dir. I'm also loathed to do that too, as in means changing the bootstrapify-docbook.sh and the make file :-( with a cp -r build/ after each step.

nixinator avatar Jun 19 '20 08:06 nixinator

I think you can simple track files in in build folder.

for example the following line

HTML = index.html download.html news.html learn.html community.html \

would become

HTML = build/index.html build/download.html build/news.html build/learn.html build/community.html \

Also you would need to add some sections for static resources, example:

favicon.png:
    cp $@ build/$@

garbas avatar Jun 19 '20 09:06 garbas

This may work, however i was trying to have the output directory configurable with OD = someoutputdirectory/

I'm sure is the what xsltproc and tpage work with local and unlocal paths....

rather than prefix build/ everywhere... :-)..

the trick is getting all in one place, and not breaking anything!! :-)

nixinator avatar Jun 19 '20 11:06 nixinator