Skip to content

Output of JBake compilation is incorrect #11

@hmf

Description

@hmf

I was trying to serve the site using the following command:

~/VSCodeProjects/hashnode-pubs$ ./mill -i site.jbakeServe

Unfortunately that will fail because JBake serving expects the site to be in an output directory. In my case the jbake command placed the compile site into:

/home/hmf/VSCodeProjects/hashnode-pubs/out/site/jbake.dest

But as the output below shows, serving requires the output to be in:

/hmf/VSCodeProjects/hashnode-pubs/out/site/jbake.dest/output

Here is the output:

[8/8] site.jbakeServe 
JBake v2.6.7 (2021-05-14 21:54:29[GMT+01:00]) [http://jbake.org]

18:19:47.956 INFO  org.jbake.launcher.BakeWatcher - Watching for (content, template, asset) changes in [/home/hmf/VSCodeProjects/hashnode-pubs/out/site/jbake.dest]
18:19:48.025 INFO  org.jbake.launcher.JettyServer - Serving out contents of: [/home/hmf/VSCodeProjects/hashnode-pubs/out/site/jbake.dest/output] on http://localhost:8820/
18:19:48.025 INFO  org.jbake.launcher.JettyServer - (To stop server hit CTRL-C)

The JBake documentation says:

"The -b option without any parameters will assume your source content is in the current working directory and will place the baked output into a directory named output in the current directory:"

I don't think the FIXME of the def jbakeServe(): Command[Unit] target is the problem. I am assuming that the def jbake: T[PathRef] target is setting both the input and output directories. So to solve this I think it is only necessary to add an /output to the jbake output path. Note that setting the path in the server command doesn't help because JBake always adds /output to the path. Here is an example showing this:

./mill -i site.jbakeRun -s /home/hmf/VSCodeProjects/hashnode-pubs/out/site/

And here is the output:

[6/6] site.jbakeRun 
JBake v2.6.7 (2021-05-14 21:54:29[GMT+01:00]) [http://jbake.org]

18:04:16.930 INFO  org.jbake.launcher.BakeWatcher - Watching for (content, template, asset) changes in [/home/hmf/VSCodeProjects/hashnode-pubs/out/site/jbake.dest]
18:04:17.000 INFO  org.jbake.launcher.JettyServer - Serving out contents of: [/home/hmf/VSCodeProjects/hashnode-pubs/out/site/jbake.dest/output] on http://localhost:8820/
18:04:17.000 INFO  org.jbake.launcher.JettyServer - (To stop server hit CTRL-C)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions