How to use the option function from grunt

Find comprehensive JavaScript grunt.option code examples handpicked from public code repositorys.

13
14
15
16
17
18
19
20
21

if (options) {
  for (var key in options) {
    baseOptions[key] = options[key];
    if(key != 'base' && key != 'prefix'){
      grunt.option(key, options[key]);
    }
  }
}
fork icon22
star icon167
watch icon4

132
133
134
135
136
137
138
139
140
141
// node_configs/connect.js
'use strict';
var grunt = require('grunt')
module.exports = {
    options: {
        port: grunt.option('port') || 9001
    },
    server: {
        // ...
    }
fork icon1
star icon3
watch icon3

5
6
7
8
9
10
11
12
13
14
var Helpers = {};
var base = process.cwd();
var glob = require('glob');

/* Overwrite browser env variables if grunt options are set */
var browsers = grunt.option('browser') || grunt.option('browsers');
if (browsers) {
  process.env.KARMA_BROWSERS = browsers;
  process.env.PROTRACTOR_BROWSERS = browsers;
}
fork icon45
star icon1
watch icon31

6
7
8
9
10
11
12
13
14
15
 * - the template string is set by the prompt:init task
 */

var grunt = require('grunt'),
        Helpers = require('../helpers'),
        component = grunt.option('name') || '';

module.exports = {
        init: {
                src: [
fork icon2
star icon16
watch icon18

2
3
4
5
6
7
8
9
10
11
 *
 * https://www.npmjs.com/package/grunt-file-creator
 */

var grunt = require('grunt'),
        component = grunt.option('name') || '',
        date = new Date().toISOString().substring(0, 10);

module.exports = {
        componentFiles: [
fork icon2
star icon16
watch icon18

200
201
202
203
204
205
206
207
208
209
createKarmangularConfig: function() {
  if (grunt.option('fast')){
    var versions = [util.latestAngular()];
  } else {
    // For each file found, make sure it's a directory...
    var versions = grunt.option('angular') ? grunt.option('angular').split(/,/) : null || util.angulars();
  }

  if (grunt.option('angular')) {
    if (grunt.option('angular') === 'latest') {
fork icon0
star icon1
watch icon0

+ 13 other calls in file

168
169
170
171
172
173
174
175
176
177
// The main grunt task
*/
grunt.registerTask('nsp-audit', 'Audits package.json against nodesecurity.io API', function () {
    var done = this.async(),
        config = makeConfig(grunt.config.get('nsp-audit')),
        file = grunt.option('nsp-file');

    if (file) {
        config.files = [file];
    }
fork icon0
star icon0
watch icon3

+ 15 other calls in file

179
180
181
182
183
184
185
186
187
188

if (grunt.option('fast')){
  versions = [util.latestAngular()];
} else {
  // For each file found, make sure it's a directory...
  versions = grunt.option('angular') ? grunt.option('angular').split(/,/) : null || util.angulars();
}

if (grunt.option('angular')) {
  if (grunt.option('angular') === 'latest') {
fork icon0
star icon0
watch icon363

+ 27 other calls in file

13
14
15
16
17
18
19
20
21

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);
  }
fork icon0
star icon0
watch icon1