SassDoc / sassdoc

Release the docs!
http://sassdoc.com
MIT License
1.41k stars 56 forks source link

Add ability to use --debug with Gulp #406

Open KittyGiraudel opened 9 years ago

KittyGiraudel commented 9 years ago

In a Gulp setup, debug: true does not print anything.

gulp.task('sassdoc', function () {
  return gulp
    .src('./**/*.scss')
    .pipe(sassdoc({
      dest: './views/sassdoc',
      config: './.sassdocrc', 
      debug: true,
      verbose: true
    }))
    .resume();
});
[15:39:43] Starting 'sassdoc'...
[15:39:43] Finished 'sassdoc' after 164 ms
» [WARNING] Parser for annotation `flag` not found. Location: `linePoster.test.scss:5:8`
» Sass sources successfully parsed.
» Folder `views/sassdoc` successfully refreshed.
» Theme `default` successfully rendered.
» Process over. Everything okay!
✓ SassDoc completed after 164ms
valeriangalliat commented 9 years ago

--debug is indeed a CLI option, but not a configuration option.

However you can always set the SASSDOC_DEBUG environment variable to enable debugging from anywhere:

SASSDOC_DEBUG=1 gulp sassdoc
valeriangalliat commented 9 years ago

So I'm not sure how to deal with this issue. It's not a bug, and everything works like documented, so we could close, but maybe adding a debug option is desirable?

KittyGiraudel commented 9 years ago

Perhaps yep.

valeriangalliat commented 9 years ago

Technically this is more a new feature, but we must wait 2.2 to release it if we consider it as so. If we see this as a bug, I can release the debug option right away in a patch. What do you think?

(I have code ready.)

KittyGiraudel commented 9 years ago

@SassDoc/owners?

pascalduez commented 9 years ago

It feels like that something users might want, and would be more familiar with: passing the option into the gulp/grunt/... task rather than from the command line. Semantically yes, we should wait for 2.2 ^^

pascalduez commented 9 years ago

@valeriangalliat how would that work with the JSON file dumping ? Maybe not needed ?

Might be a good idea to move all the debug logic into its own file and just call methods. Similar to the debug package.

valeriangalliat commented 9 years ago

@pascalduez It would dump a sassdoc-data.json in the CWD, as usual. I think it's as useful in plugins as in CLI.

I don't get what you mean with the debug logic... the debug function is already in logger.js, and we use it like the debug package if I'm right?