Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

please support config file. #14

Open
liu946 opened this issue Sep 12, 2016 · 3 comments
Open

please support config file. #14

liu946 opened this issue Sep 12, 2016 · 3 comments

Comments

@liu946
Copy link

liu946 commented Sep 12, 2016

the .esdocrc file can use in esdoc module. I didn't find a way to use config-file way in gulp-esdoc.

@liu946
Copy link
Author

liu946 commented Sep 12, 2016

I have checked your code and find that config file is 'path/to/dir/esdoc.json'. please use the input string user-defined path instead when config is a STRING.

@ghost
Copy link

ghost commented Mar 15, 2017

So the solution is to require your config file like so
const esdocConfig = require( "./path/to/dir/esdoc.json" );
then:
gulp.src(["./src"]).pipe( esDoc( esdocConfig ) );
Should do it!

@colbin8r
Copy link

This plugin supports ESDoc config file. The real issue is in the name of the file it looks for: tt should look for .esdoc.json as stated by the docs, but instead looks for a esdoc.json file.

ESDoc automatically finds the configuration file path by the order, if you don't specify -c esdoc.json.

  1. .esdoc.json in the current directory
  2. .esdoc.js in the current directory
  3. esdoc property in package.json

In the meantime, you could do something like this ES6 code, which I myself use:

let esdocConfigPath = path.join(process.cwd(), '.esdoc.json'), data, esdocConfig;
if (fs.existsSync(esdocConfigPath)) {
  data = fs.readFileSync(esdocConfigPath, { encoding: 'utf8' });
  esdocConfig = !data ? {} : JSON.parse(data);
  console.log('Found ESDoc config in .esdoc.json!');
} else {
  esdocConfig  = {};
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants