Conversation
With the new watchexec package, running a wisp server and auto-rebuilding the site is a breeze, so I thought it was time to tap into the Gleam ecosystem for this.
|
|
||
| fn rebuild_assets(changed_paths: List(String)) { | ||
| list.each(changed_paths, fn(path) { | ||
| let dest = string.replace(path, each: "/priv", with: "/dist") |
There was a problem hiding this comment.
This could do weird stuff if someone has a highler level /priv* directory. Can we strip the current working directory from the path instead? 🙏
Something like this maybe
fn rebuild_assets(cwd: String, changed_paths: List(String)) {
list.each(changed_paths, fn(path) {
let assert Ok(#("", shortened_path)) = string.split_once(path, cwd <> "/priv")
as { path <> " not within priv dir" }
// ...|
Great call on the working dir, decided to just directly call out to Erlang instead of bringing in a whole new dependency just for one function |
|
Turns out I'm not the sharpest tool in the shed and this needs more work. Just simply running website.build_site inside the dev process actually just reruns the old code, so changes don't show up. Will require either some looking into OTP hot code replacement or cheesing it with shellout, I think. |
|
We could just run |
Yeah, I've done this in my local branch but it really feels not-so-good. I'd really like to come up with a smarter solution, honestly. |
|
wdym doesn't feel good? Not any way around needing to recompile code when it changes. |
Cheerio!
With the new watchexec package, running a wisp server and auto-rebuilding the site is a breeze, so I thought it was time to tap into the Gleam ecosystem for this, instead of using my currently very cursed local setup. Feels so nice to just run
gleam devand not think about it again.I've gone to some level of thought (as far as my peanut brain can go, anyway) for static assets, so we don't have to rebuild the entire website every time a single line of CSS is changed, for example.