Statac

Problems explained

Output folder named

warning A warning says what Statac did instead, and the build goes on.

The site’s after_build command names the folder the built site is published in, _site unless the build was asked for another. While the command runs, that folder still holds the site built last time.

What you’ll see

warning  Output folder named: `_site` holds the site built last time while `after_build` runs
  Write it as `./index.sh "$STATAC_OUT"`.
  More: https://statac.dev/e/output-folder-named/

In the terminal the message also names the file and line where there is one, and marks the exact text.

Why Statac warns

Statac builds into a folder of its own and puts it in the published site’s place only once the whole build, after_build included, has ended well. A command that names _site therefore acts on the last build: an index is made of the old pages, old files are compressed or sent to the server, and whatever the command writes there is replaced a moment later by the new site. On a first build there is no such folder at all.

Nothing in what the command prints need show it, so Statac says so.

How to fix it

Name the folder Statac hands the command, STATAC_OUT, where the line names the output folder. sh writes it "$STATAC_OUT" and cmd writes it "%STATAC_OUT%". The message shows the line written that way.

Where the command really does mean the site built last time, quiet: [output-folder-named] stops the warning being shown.

Example

In statac.yaml:

after_build: ./index.sh _site

While the command runs, _site still holds the site built last time. Written to act on the new build, in $STATAC_OUT:

after_build: ./index.sh "$STATAC_OUT"

Its name

Nameoutput-folder-named
In the terminalstatac explain output-folder-named
To stop showing itquiet: [output-folder-named] in statac.yaml, once you have understood it. Statac still counts it.

Something unclear or wrong? Open an issue on GitHub.