Open bsansouci opened 6 years ago
seems too bad to have to solve this problem with reprocessing magic.. but yeah I remember thinking about this back when we added fonts. Will give it some more thought.
For small assets ocaml crunch or wtv we used for the font should work ok
https://caml.inria.fr/pub/docs/manual-ocaml/libref/Pervasives.html ___FILE__
is an absolute path to the file being parsed, is there some way that that would help?
(too bad there's no way to get the __FILE__
of the person who called the function lol)
Right now it's not clear how to bundle assets with a reprocessing app. If I make a library that allows people to draw checkboxes for example, in my code I'll have something like
let internalState = { checkboxCheckedAsset: Draw.loadImage(~src="assets/checkbox-checked.png", env)
. The path to the asset is relative, so where should we be looking for it?I think the simplest answer is that it should look relative to the project that the file belongs to. This is a bit tricky because there's no easy way to get access to the path of the current file or project. If we had a way to access build system internals during compilation, we could have the build system pass the path of the project being compiled. Then reprocessing could automatically handle turning the relative paths into absolute paths.