Skip to content

Commit

Permalink
🔧 Fix bug where static assets under a directory would not be correctl…
Browse files Browse the repository at this point in the history
…y written.
  • Loading branch information
hayleigh-dot-dev committed Sep 1, 2024
1 parent 57705a9 commit 146e8e9
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/lustre/ssg.gleam
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
// IMPORTS ---------------------------------------------------------------------

import filepath
import gleam/dict.{type Dict}
import gleam/list
import gleam/option.{type Option, None, Some}
Expand Down Expand Up @@ -69,7 +70,11 @@ fn do_build(

use _ <- result.try({
use #(path, content) <- list.try_map(dict.to_list(static_assets))
simplifile.write(temp <> path, content)
let dir = filepath.directory_name(path)

filepath.join(temp, dir)
|> simplifile.create_directory_all
|> result.then(fn(_) { simplifile.write(temp <> path, content) })
|> result.map_error(CannotWriteStaticAsset(_, path))
})

Expand Down

0 comments on commit 146e8e9

Please sign in to comment.