12

How would I use dub to make DDocs from my source files? There appears to be no default command in dub to do this, and I'd really like to be able to automate this process.

Koz Ross
  • 3,040
  • 2
  • 24
  • 44

1 Answers1

8

Building docs through dub is actually specified through a build type.

Try dub build --build=docs or dub build --build=ddox.

The former builds 'plain' ddocs, the latter uses dub to fetch ddox to format your docs.

This is actually shown in the help, its just well hidden. Take a look at the 'build' section of dub build -h (you can use dub <command> -h to get detailed help on a specific command).

rcorre
  • 6,477
  • 3
  • 28
  • 33
  • 1
    As my compiler is GDC, as it turns out, this doesn't work without some additional changes to ``dub.json``. Specifically, you have to add the following: "buildTypes": { "docs": { "buildOptions": ["syntaxOnly"], "dflags": ["-c", "-fdoc", "-fdoc-dir=./docs"] } } – Koz Ross Apr 21 '15 at 19:22
  • 1
    Interesting -- you may want to report that upstream to dub, as I think it should generate the proper flags for you. – rcorre Apr 22 '15 at 01:38
  • The `dub build --build=docs` place the output in the `docs` folder but where does `dub build --build=ddox` place its output? – Nordlöw Feb 23 '20 at 18:38