better-docs icon indicating copy to clipboard operation
better-docs copied to clipboard

Assets Files Not Copied Into Generated Docs Folder

Open RilDev opened this issue 3 years ago • 4 comments

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!

RilDev avatar May 10 '21 15:05 RilDev

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.

dmccormack3 avatar May 11 '21 13:05 dmccormack3

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!

RilDev avatar May 12 '21 07:05 RilDev

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!

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.

Shogan avatar Jul 29 '21 11:07 Shogan

Need to know how much the money in the bank so that I can get the truck to rolling the contract

adlawan avatar Dec 01 '21 12:12 adlawan