How do I run ng-docs through webpack?

789 Views Asked by At

I recently decided to embrace webpack for a majority of my JavaScript related builds and bundles, but there is one part that I have never been able to figure out: How do I run ng-docs using webpack?

I am aware of ng-docs being able to be run through grunt and gulp via their respective ng-doc packages, but I would ideally not want to depend on one of those runners if I am already utilizing webpack (especially if I need it for just one small thing).

I have searched the Internet off and on for something to run ng-docs via webpack (I would have expected some sort of plugin that works with a loader or something to do this), or just a plain ng-docs package that I can wrap using some NodeJS code inside my webpack config, but have had no luck finding anything. Does such a package exist that I can just use webpack for it via a plugin and/or loader? Is there a package that lets me just run ng-docs from the command line?

1

There are 1 best solutions below

2
Sean Larkin On

Since ng-docs has a simple CLI, you can add a docsConfig.json file in your project root for ngDocs configuration, and then chain the ngdocs command to your Webpack build commands in you package.json scripts key.

"scripts": {
    "build": "ngdocs && webpack"
}

You could go even as far as running ngdocs against your dev bundle in development environments.