Open ghost opened 8 years ago
It's an environment variable; the module uses https://github.com/visionmedia/debug under the hood. See that repo for a discussion of precisely how to set it for your environment.
Thanks a lot! It was a bit confusing, but I managed to make it work.
Any idea if there's a cross-platform solution for this? I made it work just for Windows, and I don't think it's the most elegant solution. Check out the build script in package.json, in my repo: https://github.com/dudezilla80/Metalsmith-Boilerplate/
Well, since there's no way to have logic in your package.json file, you can't make it cross-platform there. If you're always going to run it, you could just set process.env.DEBUG='metalsmith-timer' inside your build javascript file.
I'd pretty much prefer that it always ran. I'd like to use it for a watcher task that would be pretty verbose when it ran.
It seems like I still can't make it work, even if I set process.env.DEBUG='metalsmith-timer' inside the build file. Could you please take a look at the tryDebug branch?
Ah, if you move the process.env.DEBUG='metalsmith-timer'
to a line above where you include metalsmith-timer
, it works. debug
initializes which modules to fire debug messages for at the moment it's included, and if you modify the environment after that, it doesn't see it.
process.env.DEBUG='metalsmith-timer';
var Metalsmith = require('metalsmith'),
layouts = require('metalsmith-layouts'),
timer = require('metalsmith-timer');
Metalsmith(__dirname)
...
Hi!
Can you please explain me how exactly am I supposed to add DEBUG=metalsmith-timer to the call?
Thank you!