How to use the config function from grunt
Find comprehensive JavaScript grunt.config code examples handpicked from public code repositorys.
20 21 22 23 24 25 26 27 28 29
function existsFileInOutput(filename) { return fs.existsSync(path.join(outputDirectory, filename)); } grunt.config.init({ pkg: grunt.file.readJSON(path.join(__dirname, 'fixtures', 'app', 'resources', 'app', 'package.json')), 'create-windows-installer': { config: { appDirectory: path.join(__dirname, 'fixtures', 'app'),
104
392
21
58 59 60 61 62 63 64 65 66 67
('warnings', []) ('global-dependencies', helpers.createStore()) ('.bowerrc', grunt.file.readJSON('.bowerrc')) ('bower.json', findBowerJSON(store)) ('ignore-path', grunt.config.data['bower-install'].ignorePath) ('html-file', grunt.config.data['bower-install'].html) ('html', grunt.file.read(grunt.config.data['bower-install'].html)) ('directory', store.get('.bowerrc').directory || 'bower_components') return store;
87
0
1
+ 3 other calls in file
GitHub: maxov/gulp-grunt
89 90 91 92 93 94 95 96 97 98
for (var name in gruntTasks) { if (gruntTasks.hasOwnProperty(name)) { // add tasks registerGruntTask(name); // also add target-specific tasks for (var target in grunt.config.get(name)) { registerGruntTask(name + ':' + target); } } }
22
167
4
2 3 4 5 6 7 8 9 10 11
module.exports = { options: { templateBasePath: /app\//, templateFileExtensions: /\.(hbs|hjs|handlebars)/, templateRegistration: function(name, template) { return grunt.config.process("define('<%= package.namespace %>/") + name + "', [], function(){ return " + template + "; });"; } }, debug: { options: {
6
18
4
54 55 56 57 58 59 60 61 62 63
} }); // Expose task.requires on `this`. this.requires = task.requires.bind(task); // Expose config.requires on `this`. this.requiresConfig = grunt.config.requires; // Return an options object with the specified defaults overwritten by task- // specific overrides, via the "options" property. this.options = function() { var args = [{}].concat(grunt.util.toArray(arguments)).concat([
3
0
0
+ 41 other calls in file
GitHub: brandung/capitan
12 13 14 15 16 17 18 19 20 21
module.exports = { init: { src: [ './grunt/config.js', './grunt/systems/<%= grunt.config("initSystem") %>.json' ], overwrite: true, replacements: [ {
2
16
18
+ 9 other calls in file
GitHub: ejcarranzap/worldvision
213 214 215 216 217 218 219 220 221 222
grunt.log.writeln("Using angular " + grunt.util.pluralize(versions, "version/versions") + ": " + versions.join(', ')); } versions.forEach(function (version) { // .. then create a karma config for it! var karmaConfigName = 'angular-' + grunt.config.escape(version); if (grunt.option('core') || grunt.option('fast')){ grunt.config('karma.' + karmaConfigName, { options: {
0
1
0
+ 21 other calls in file
GitHub: oiva/react
38 39 40 41 42 43 44 45 46
// Uncomment these to see the output of the commands. // proc.stdout.pipe(process.stdout); // proc.stderr.pipe(process.stderr); } var pkg = grunt.config.data.pkg; var tgz = pkg.name + '-' + pkg.version + '.tgz'; grunt.log.writeln('Packing ' + tgz + ' (this could take a while)...');
0
0
2
GitHub: jidesakin/react
21 22 23 24 25 26 27 28 29 30
return UglifyJS.minify(src, {fromString: true}).code; } // TODO: move this out to another build step maybe. function bannerify(src) { var version = grunt.config.data.pkg.version; var packageName = this.data.packageName || this.data.standalone; return ( grunt.template.process( LICENSE_TEMPLATE,
0
0
2
+ 3 other calls in file
37 38 39 40 41 42 43 44 45 46
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: SanderSpies/react
7 8 9 10 11 12 13 14 15 16
// This task is async... var done = this.async(); // More/better assertions // grunt.config.requires('outfile'); // grunt.config.requires('entries'); config.transforms = config.transforms || []; config.after = config.after || []; if (typeof config.after === 'function') {
0
0
2
+ 3 other calls in file
14 15 16 17 18 19 20 21 22 23
console.log("update/tasks/wordpressupdate.js"); grunt.registerTask('pull_site', 'pulls the files and DB from the remote server', function() { var target = grunt.option('target') || task_options['target']; if ( typeof target === "undefined" || typeof grunt.config.get('wordpressdeploy')[target] === "undefined" || target === "local") { grunt.fail.warn("Invalid target specified. Did you pass the wrong argument? Please check your task configuration.", 6); } console.log("pulling site from " + target);
0
0
1
13 14 15 16 17 18 19 20 21 22
})); process.stdout.write('\n'); }; grunt.task.registerMultiTask('parseApi', 'Api automatic parser', function () { var config = grunt.config.get('parseApi'), done = this.async(), files = grunt.file.expand(config.basePath + '/**/*.mp3'), global = [], artists = {},
0
0
2
GitHub: oiva/react
74 75 76 77 78 79 80 81 82 83
grunt.log.error('Make sure you have the react gh-pages branch checked ' + 'out at ../react-gh-pages.'); return false; } VERSION = grunt.config.data.pkg.version; VERSION_STRING = 'v' + VERSION; } function bower() {
0
0
2
+ 7 other calls in file
GitHub: wrdsb/canvas-lms
10 11 12 13 14 15 16 17 18 19
}; var loadOptions = function(path) { glob.sync('*', { cwd: path }).forEach(function(option) { var key = option.replace(/\.js$/,'').replace(/^grunt\-/, ''); grunt.config.set(key, require(path + option)); }); }; var loadTasks = function(path) {
0
0
20
GitHub: fusionbox/angular.js
110 111 112 113 114 115 116 117 118 119
//concat var src = files.map(function(filepath){ return grunt.file.read(filepath); }).join(grunt.util.normalizelf('\n')); //process var processed = this.process(src, grunt.config('NG_VERSION'), config.strict); if (styles) processed = this.addStyle(processed, styles.css, styles.minify); //write grunt.file.write(config.dest, processed); grunt.log.ok('File ' + config.dest + ' created.');
0
0
5
GitHub: Terebinth/react
5 6 7 8 9 10 11 12 13 14
// package. This is not an ideal way to do this, but makes sure that we keep // them in sync. var reactVersionExp = /\bReact\.version\s*=\s*['"]([^'"]+)['"];/; module.exports = function() { var pkgVersion = grunt.config.data.pkg.version; var versions = { 'packages/react/package.json': grunt.file.readJSON('./packages/react/package.json').version,
0
0
2
GitHub: ascom-au/react
29 30 31 32 33 34 35 36 37 38
} }); // modify build/react-core/package.json to set version ## var pkg = grunt.file.readJSON(dest + 'package.json'); pkg.version = grunt.config.data.pkg.version; grunt.file.write(dest + 'package.json', JSON.stringify(pkg, null, 2)); } function buildDev() {
0
0
9
grunt.file is the most popular function in grunt (372 examples)