Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to debug Gruntfile.js with log statements?

In my Gruntfile, how can I add log statements, to its processing, as in the following example?

 karma: {
        unit: {
            configFile: "<%= grunt.option('Debug') ? 'build/karma.conf.js' : '' %>",
            console.log(configFile),
            singleRun: true,
            browsers: ['PhantomJS']
        },
    }
like image 575
Gururaj Avatar asked Sep 25 '13 16:09

Gururaj


2 Answers

Gruntfiles are javascript so you can use console.log() where ever as long as it is valid javascript.

grunt.initConfig({
  karma: {
    unit: {
      configFile: 'build/karma.conf.js'
    }
  }
});
if (grunt.option('debug')) {
  console.log(grunt.config('karma.unit.configFile'));
}
like image 166
Kyle Robinson Young Avatar answered Sep 23 '22 07:09

Kyle Robinson Young


I'm not what you are asking, but if you want to place debug logging in a Gruntfile.js, have you seen the grunt.log method?

like image 27
Lee Goddard Avatar answered Sep 21 '22 07:09

Lee Goddard