Skip to content

Commit

Permalink
Support reading asbolute paths.
Browse files Browse the repository at this point in the history
Fixes #390.
  • Loading branch information
dillonkearns committed Jan 10, 2024
1 parent 73d38cf commit a8c9f00
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 7 deletions.
2 changes: 2 additions & 0 deletions examples/end-to-end/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 1 addition & 6 deletions generator/src/render.js
Original file line number Diff line number Diff line change
Expand Up @@ -512,12 +512,7 @@ async function readFileJobNew(req, patternsToWatch) {
try {
patternsToWatch.add(filePath);

const fileContents = // TODO can I remove this hack?
(
await fsPromises.readFile(
path.join(process.env.LAMBDA_TASK_ROOT || process.cwd(), filePath)
)
).toString();
const fileContents = (await fsPromises.readFile(filePath)).toString();
// TODO does this throw an error if there is invalid frontmatter?
const parsedFile = matter(fileContents);

Expand Down
3 changes: 2 additions & 1 deletion src/BackendTask/File.elm
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ module BackendTask.File exposing
)

{-| This module lets you read files from the local filesystem as a [`BackendTask`](BackendTask#BackendTask).
File paths are relative to the root of your `elm-pages` project (next to the `elm.json` file and `src/` directory).
File paths are relative to the root of your `elm-pages` project (next to the `elm.json` file and `src/` directory), or
you can pass in absolute paths beginning with a `/`.
## Files With Frontmatter
Expand Down

0 comments on commit a8c9f00

Please sign in to comment.