Dub documentation with an initial ddoc file
    Anton Fediushin via Digitalmars-d-learn 
    digitalmars-d-learn at puremagic.com
       
    Mon Sep  4 01:19:26 PDT 2017
    
    
  
On Sunday, 3 September 2017 at 23:14:15 UTC, Conor O'Brien wrote:
> I've been trying to figure out how to generate documentation 
> for my project using dub. I have found this link[1] which told 
> me how I could use dub to generate docs:
>
>     dub build --build=docs <project-name>
>
> However, I wish to have a set of macros that are present on 
> every documentation file, that would define how the resultant 
> HTML document is rendered. I tried:
>
>     dub build --build=docs <project-name> html.ddoc
>
> But I got the following error:
>
>     Expected one or zero arguments.
>     Run "dub build -h" for more information about the "build" 
> command.
>
> How might I include `html.ddoc` with every file that has 
> documentation?
Add this to your dub.json:
"configurations": [
   {
     "name": "docs",
     "buildOptions": ["syntaxOnly"],
     "dflags": ["-Dddocs"],
     "sourceFiles": ["html.ddoc"]
   }
]
Or if you use dub.sdl:
configuration "docs" {
   buildOptions "syntaxOnly"
   dflags "-Dddocs"
   sourceFiles "html.ddoc"
}
This adds a new configuration named "docs", which can be used 
like this:
$ dub -c docs
    
    
More information about the Digitalmars-d-learn
mailing list