How to use the log function from grunt
Find comprehensive JavaScript grunt.log code examples handpicked from public code repositorys.
80 81 82 83 84 85 86 87 88 89
if (loadPath !== '' && !grunt.util._.contains(this.filesLoadedSoFar, loadPath) && !grunt.util._.contains(this.beingLoaded, loadPath)) { currentDepth.push(" "); if (this.printDepGraph) { grunt.log.writeln(currentDepth.join("") + className); } this.beingLoaded.push(loadPath); try { eval(grunt.file.read(loadPath));
21
0
2
+ 5 other calls in file
GitHub: phated/grunt-enyo
13 14 15 16 17 18 19 20 21
// Draw the help screen. function displayHelp(withFlags) { var pkg = require(path.normalize(__dirname + '/../package.json')); grunt.log.writeln(); grunt.log.writeln(template('<%= _.capitalize(name).blue.inverse %> - version: <%= version %> - <%= description %>', pkg)); var col1len = 1; var widths;
7
10
5
+ 11 other calls in file
191 192 193 194 195 196 197 198 199 200
// Log this.file src and dest properties when --verbose is specified. if (grunt.option('verbose')) { files.forEach(function(obj) { var output = []; if ('src' in obj) { output.push(obj.src.length > 0 ? grunt.log.wordlist(obj.src) : '[no src]'.yellow); } if ('dest' in obj) { output.push('-> ' + (obj.dest ? String(obj.dest).cyan : '[no dest]'.yellow)); }
3
0
0
+ 5 other calls in file
GitHub: eclifford/towelie
35 36 37 38 39 40 41 42 43 44
// Draw the help screen. function displayHelp() { var pkg = require(__dirname + "/../package.json"); grunt.log.writeln(); grunt.log.writeln(pkg.description); grunt.log.writeln((" " + pkg.name + " ").green.inverse + " Version - " + pkg.version); // Borrowed heavily from the Grunt help source. var col1len = 0;
0
4
2
+ 13 other calls in file
24 25 26 27 28 29 30 31 32 33
if (!helpers.is(bowerJSON, 'object') && grunt.file.isFile(configFile)) { bowerJSON = grunt.file.readJSON(configFile); if (configFile !== 'bower.json') { grunt.log.writeln(); grunt.log.warn(configFile.yellow + ' is deprecated.'.yellow); grunt.log.writeln('Your dependencies are going to be managed in "bower.json" going forward. Everything will carry over. :)'.cyan); grunt.log.writeln(); } }
87
0
1
+ 13 other calls in file
GitHub: gruntjs/grunt-init
72 73 74 75 76 77 78 79 80 81
'footer', ]; // Header grunt.help.header = function() { grunt.log.writeln('grunt-init: Generate project scaffolding from a template. (v' + pkg.version + ')'); }; // Usage info. grunt.help.usage = function() {
71
191
0
+ 13 other calls in file
GitHub: imclab/spotlight
12 13 14 15 16 17 18 19 20 21
} }); // Register your own tasks grunt.registerTask('mytask', function() { grunt.log.write('Ran my task.'); }); // Load tasks from npm grunt.loadNpmTasks('grunt-contrib-jasmine');
25
0
0
+ 3 other calls in file
GitHub: maxov/gulp-grunt
70 71 72 73 74 75 76 77 78 79
); child.stdout.on('data', function (d) { grunt.log.write(d); }); child.stderr.on('data', function (d) { grunt.log.error(d); }); child.on('close', function (code) { if (opt.verbose) { grunt.log.ok('[grunt-gulp] Done running Grunt "' + name + '" task.');
22
167
4
+ 5 other calls in file
21 22 23 24 25 26 27 28 29 30
}; // overwrite helper's logging methods cHelpers.log = { warn: function(msg) { localGrunt.log.warn(msg); }, info: function(msg) { localGrunt.log.writeln(msg); }, error: function(msg) { localGrunt.log.error(msg); }, debug: function(debug, msg) { if ( !debug ) return; localGrunt.log.writeln( 'debug :: '.blue + msg );
21
95
6
+ 7 other calls in file
48 49 50 51 52 53 54 55 56 57
// Append a last function to kill spawnGrunt runs.push(function() { spawnGrunt.kill('SIGINT'); }); // After watch starts waiting, run our commands then exit spawnGrunt.stdout.on('data', function(data) { data = grunt.log.uncolor(String(data)); out += data; // If we should run the next function var shouldRun = true;
9
60
6
GitHub: upstage/grunt-reverse
123 124 125 126 127 128 129 130 131
data[tag] = data[tag] || []; var content = ''; $(tag).map(function(i, element) { console.log($(this)); grunt.log.ok('element:'.yellow, tag); var text = $(this).text(); var html = $(this).html();
2
4
7
+ 11 other calls in file
4 5 6 7 8 9 10 11 12 13
bar: 'Hello Grunt', } }); grunt.registerMultiTask('log', 'Log stuff.', function() { grunt.log.writeln(this.data); }); grunt.registerTask('test', ['log']);
1
7
4
GitHub: wacky6/grunt-fontmin
53 54 55 56 57 58 59 60 61
// solve dest path, write output let destPath = join(destdir, getOutputFilename(path,type)) grunt.file.write(destPath, toBuffer(output)) // output information grunt.log.writeln(basename(path)+' => '+type+' ' +chalk.green(stripped.glyf.length)+' glyphs, ' +chalk.green(output.byteLength)+' bytes') } )
1
2
2
GitHub: QLess/build-grunt
49 50 51 52 53 54 55 56 57 58
var cwd = process.cwd() // Load all the required grunt task plugins. Requires first changing to here // and then changing back after the tasks are run. Since grunt doesn't report // when it can't load something, "spy" on its error var err = grunt.log.error var missing = [] grunt.log.error = function (msg) { var match = /Local Npm module "([a-zA-Z0-9-_@/]+)" not found/.exec(msg) if (match) {
1
0
11
+ 3 other calls in file
30 31 32 33 34 35 36 37 38 39
bowerUpdate(options.update) .on('log', function(result) { grunt.log.writeln(['bower', result.id.cyan, result.message].join(' ')); }) .on('error', function(error) { grunt.log.writeln(error); done(false); }) .on('end', function(updated) { done();
2
0
2
+ 5 other calls in file
38 39 40 41 42 43 44 45 46 47 48 49
version = semver.inc(version, release) grunt.log.writeln('Updated package version: ' + version) writePackageVersion(version) grunt.log.writeln('Done updating the package version') updateLibraryFiles(version) grunt.log.writeln('Done updating the library files') } function readPackageVersion() {
0
1
0
+ 4 other calls in file
GitHub: ejcarranzap/worldvision
208 209 210 211 212 213 214 215 216 217
if (grunt.option('angular')) { if (grunt.option('angular') === 'latest') { versions = [util.latestAngular()]; } grunt.log.writeln("Using angular " + grunt.util.pluralize(versions, "version/versions") + ": " + versions.join(', ')); } versions.forEach(function (version) { // .. then create a karma config for it!
0
1
0
+ 9 other calls in file
18 19 20 21 22 23 24 25 26 27
grunt.log.error("Failed comparison to stock example."); grunt.log.error("If these changes are intentional, please run `grunt update-stock-example` to overwrite the fixture."); if (showDiff) { grunt.log.writeln("\n" + diffs + "\n"); } else { grunt.log.error("Run `grunt test-stock-example:diff` to see differences."); } } else { grunt.log.writeln("Passed comparison to stock example."); passed = true;
0
0
0
+ 6 other calls in file
175 176 177 178 179 180 181 182 183 184
if (file) { config.files = [file]; } log = function (message) { grunt.log.writeln(message); }; warn = function (message) { if (config.failIfVulnerabilitiesFound) {
0
0
3
+ 15 other calls in file
GitHub: oiva/react
17 18 19 20 21 22 23 24 25 26
} assert.strictEqual(typeof opts, 'object'); assert.strictEqual(typeof callback, 'function'); grunt.log.writeln('> ' + cmd + ' ' + args.join(' ')); // var proc = spawn({ cmd: cmd,
0
0
2
+ 7 other calls in file
grunt.file is the most popular function in grunt (372 examples)