How to use the util function from grunt
Find comprehensive JavaScript grunt.util code examples handpicked from public code repositorys.
GitHub: JulienCabanes/Pattern-Kit
22 23 24 25 26 27 28 29 30 31
// console.log('PATHS > ' + JSON.stringify(paths)); return paths; }; module.exports = grunt.util._.extend(getHttpPathsFromJSON('data/pages.json'), { /** / dist_index: { options: {url: '<%= pkg.http_path %>/pages/index.html'}, dest: '<%= pkg.dist_dir %>/index.html'
1
2
3
+ 3 other calls in file
64 65 66 67 68 69 70 71 72 73
var config = { pkg: grunt.file.readJSON('package.json'), env: process.env }; grunt.util._.extend(config, loadConfig('./tasks/options/')); //grunt.util._.extend(config, config_manual); grunt.initConfig(config); ///////////////////////////////////////////
16
0
2
GitHub: livedata/grunt-devcode
11 12 13 14 15 16 17 18 19 20
module.exports = init; var grunt = require('grunt'), path = require('path'); var _ = grunt.util._; var defaultEnv = {}; function init(grunt) {
7
20
2
18 19 20 21 22 23 24 25 26 27
* @return {object} bower's .json configuration object */ var findBowerJSON = function (BI) { var bowerJSON; grunt.util._.each(['bower.json', 'component.json'], function (configFile) { if (!helpers.is(bowerJSON, 'object') && grunt.file.isFile(configFile)) { bowerJSON = grunt.file.readJSON(configFile); if (configFile !== 'bower.json') {
87
0
1
GitHub: gruntjs/grunt-init
26 27 28 29 30 31 32 33 34 35
if (err) { autocrlf = 'false'; } if (autocrlf === 'false') { grunt.util.linefeed = '\n'; } }); // Hook into grunt.task.init to load the built-in init task.
71
191
0
GitHub: yapplabs/glazier
39 40 41 42 43 44 45 46 47 48
var changes = Object.keys(changesJSON); var done = this.async(); var changedFilesWithinCards = changes.filter(byRegex(/^cards\//)); var changedFiles = changes.filter(byNegatedRegex(/^cards\//)); var changedCards = grunt.util._.unique(changedFilesWithinCards.map(cardName)); console.log('files', changedFiles); console.log('cardsFiles', changedFilesWithinCards); console.log('cards', changedCards);
12
79
19
28 29 30 31 32 33 34 35 36 37
var trigger = options.trigger || false; delete options.trigger; // turn options into spawn options var spawnOptions = [process.argv[1]]; grunt.util._.each(options, function(val, key) { spawnOptions.push('--' + key); spawnOptions.push(val); }); spawnOptions.push(task);
9
60
6
36 37 38 39 40 41 42 43 44 45
// Register task. parent.registerTask.apply(task, arguments); // This task, now that it's been registered. var thisTask = task._tasks[name]; // Metadata about the current task. thisTask.meta = grunt.util._.clone(registry.meta); // Override task function. var _fn = thisTask.fn; thisTask.fn = function(arg) { // Guaranteed to always be the actual task name.
3
0
0
+ 77 other calls in file
78 79 80 81 82 83 84 85 86 87
fail: 'fatal', error: errorToObject(e), errcode: errcode }); grunt.task.clearQueue(); grunt.util.exit(typeof errcode === 'number' ? errcode : grunt.fail.code.FATAL_ERROR); }; grunt.fail.warn = function (e, errcode) { process.send({
3
0
62
GitHub: upstage/grunt-reverse
37 38 39 40 41 42 43 44 45
if (!files.length) { grunt.log.writeln('No existing files in this target.'); return cb(); } grunt.util.async.forEachSeries(files, function(fp, callback) { var dest = fp.dest; var src = fp.dest; var data = {};
2
4
7
+ 5 other calls in file
GitHub: oiva/react
0 1 2 3 4 5 6 7 8
'use strict'; var assert = require('assert'); var path = require('path'); var grunt = require('grunt'); var spawn = grunt.util.spawn; module.exports = function() { var done = this.async();
0
0
2
36 37 38 39 40 41 42 43 44 45
args: ['pack', 'packages/react-noop-renderer'], opts: { cwd: 'build/', }, }; grunt.util.spawn(spawnCmd, function() { var buildSrc = 'build/react-noop-renderer-' + grunt.config.data.pkg.version + '.tgz'; var buildDest = 'build/packages/react-noop-renderer.tgz'; fs.rename(buildSrc, buildDest, done); });
0
0
3
GitHub: jaredly/react
90 91 92 93 94 95 96 97 98 99
transforms: [envify({NODE_ENV: 'development'})], packageName: 'React (with addons)', after: [simpleBannerify] }; var addonsMin = grunt.util._.merge({}, addons, { outfile: './build/react-with-addons.min.js', debug: false, transforms: [envify({NODE_ENV: 'production'})], after: [minify, bannerify]
0
0
3
+ 3 other calls in file
GitHub: piotrlewandowski/react
78 79 80 81 82 83 84 85 86 87
var args = ['--harmony', path.join('node_modules', 'jest-cli', 'bin', 'jest')]; if (configPath) { args.push('--config', configPath); } grunt.util.spawn({ cmd: 'node', args: args, opts: { stdio: 'inherit', env: { NODE_ENV: 'test' } }, }, function(spawnErr, result, code) {
0
0
2
+ 7 other calls in file
GitHub: oiva/react
48 49 50 51 52 53 54 55 56 57
var gitTag = { cmd: 'git', args: ['tag', tag], opts: opts }; grunt.util.spawn(gitAddAll, function() { grunt.util.spawn(gitAddDel, function() { grunt.util.spawn(gitCommit, function() { if (tag) { grunt.util.spawn(gitTag, cb);
0
0
2
+ 39 other calls in file
50 51 52 53 54 55 56 57 58 59
grunt.moduleId = 'canvas_quiz_statistics'; grunt.paths = { canvasPackageShims: 'tmp/canvas_package_shims.json' }; grunt.util.loadOptions = loadOptions; grunt.util.loadTasks = loadTasks; loadOptions('./tasks/options/'); loadTasks('./tasks');
0
0
4
+ 3 other calls in file
grunt.file is the most popular function in grunt (372 examples)