1

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?

ryanlutgen
  • 2,951
  • 1
  • 21
  • 31

1 Answers1

1

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.

Sean Larkin
  • 6,290
  • 1
  • 28
  • 43
  • I'll have to look at how that one stacks up with gulp-ngdocs. I think I found that package a long time ago when I initially started looking, but disregarded it since it was last published 3 years ago :( – ryanlutgen Apr 16 '16 at 05:30
  • Well gulp-ngdocs just integrates each doc as gulp pipes the angular files through the stream. However it look as like the standalone ngdocs lib that the gulp plugin uses can just target a whole project. – Sean Larkin Apr 17 '16 at 01:16