简体   繁体   中英

Grunt JSDoc: Use jsdoc JSON file

I want to set up a Grunt task to run JSDoc. I am using grunt-jsdoc which the JSDoc npm page recommends. It works ok, but I cannot use my jsdoc.json file I have created.

{
  "tags": {
    "allowUnknownTags": true,
    "dictionaries": ["jsdoc","closure"]
  },
  "source": {
    "include": [
      "lib/",
      "routes/",
      "README.md"
    ]
  },
  "plugins": ["plugins/markdown"],
  "templates": {
    "cleverLinks": false,
    "monospaceLinks": false
  },
  "opts": {
    "destination": "public/docs"
  }
}

I have found that when I pull bits out of the JSDoc and put them in Grunt, I have no issues:

//This will generate a blank public/docs folder
jsdoc: {
    dist : {
        src: './jsdoc.json'
        options: {
            destination: 'public/docs'
        }
    }
}

I want to be able to just reference the JSON file, and have it work. Currently, doing this will not generate errors, but it doesn't do anything other then creating an empty doc folder in the base directory.

jsdoc: {
    dist : {
        src: './jsdoc.json'
    }
}

I have also verified that the jsdoc.json file is correct jsdoc -c jsdoc.json

You need to put the conf file into the options property.

jsdoc: {
   dist: {
     options: {
          configure: './jsdoc.json'
       }
   }
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM