better-docs
better-docs copied to clipboard
Assets Files Not Copied Into Generated Docs Folder
I'm trying to add a logo and a custom stylesheet on the JSDoc build configs, but the files are not copied over to the generated docs directory.
I placed my assets in a jsodc directory at the project's root. I included the directory in the configuration, but then I have to do a relative path ../jsdoc to access the logo and style file.
Is there something wrong in my configuration?
{
"tags": {
"allowUnknownTags": ["category"]
},
"source": {
"include": ["./dateTime", "./enum", "./functions", "./jsdoc"], // here I include the jsdoc directory
"includePattern": ".js$",
"excludePattern": "(node_modules/|docs)"
},
"plugins": ["node_modules/better-docs/category"],
"opts": {
"encoding": "utf8",
"destination": "docs/",
"readme": "README.md",
"recurse": true,
"verbose": true,
"template": "node_modules/better-docs"
},
"templates": {
"cleverLinks": false,
"monospaceLinks": false,
"search": true,
"better-docs": {
"name": "Helpers",
"logo": "../jsdoc/logo.jpg", // here I have to go up one directory to get the logo
"title": "Helpers",
"css": "../jsdoc/style.css", // idem here, I have to go up one directory to get the stylesheet
"hideGenerator": false,
"navLinks": [
{
"label": "Repo",
"href": "https://somepath.com"
}
]
}
}
}
Thanks!
As far as I'm aware you have to manually copy the files over to your output directory. You could create a build script that creates the doc then copies your css and logo files to the output directory.
Thanks for your answer @dmccormack3 !
Do you think it would be possible to add it as a feature to better-docs?
It would be so convenient to have an optional array in the source object with all assets we want to copy to the doc folder:
...
"source": {
...
"copy": ["path/to/file/1", "path/to/directory"]
}
Like it we could easily move the documentation folder to an other location without worrying about breaking anything!
Thanks for your answer @dmccormack3 !
Do you think it would be possible to add it as a feature to better-docs?
It would be so convenient to have an optional array in the
sourceobject with all assets we want tocopyto the doc folder:... "source": { ... "copy": ["path/to/file/1", "path/to/directory"] }Like it we could easily move the documentation folder to an other location without worrying about breaking anything!
No need to copy things around. You can use the staticFiles option in the template part of your jsdoc options file:
"default": {
"staticFiles": {
"include": [
"./docsrc/images"
]
}
}
With that done, when you generate docs, you'll end up with the static files from ./docsrc/images in your destination docs output directory.
Need to know how much the money in the bank so that I can get the truck to rolling the contract