How to use the gulp.args function in gulp

To help you get started, we’ve selected a few gulp examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github ahdinosaur / slush-pages / slushfile.js View on Github external
gulp.task('default', function (done) {
  inquirer.prompt([{
    type: 'input',
    name: 'name',
    message: "Give your app a name",
    // Get app name from arguments by default 
    default: gulp.args.join(' '),
  }, {
    type: 'input',
    name: 'description',
    message: "How would you describe the app?",
    default: "it's a real sweet app",
  }, {
    type: 'input',
    name: 'author',
    message: "What is your name on GitHub?",
    default: 'author',
  }, {
    type: 'list',
    name: 'license',
    message: "Choose a license:",
    choices: Object.keys(licenses),
    default: 'ISC',
github russellf9 / f9-ionic-webrtc / gulp / tasks / build / index.js View on Github external
gulp.task('index', function(cb) {

    //plugins.log('stuff happened', 'Really it did', plugins.colors.magenta('123'));
    //gutil.log('plugins: ',plugins);
    gulp.plugins.util.log('Index - I`m working! build: ', gulp.args.build);

    // note:  config.paths.target = browserPlatform = './platforms/browser/www'
    //

    var build = gulp.args.build || gulp.args.emulate || gulp.args.run,
    // define the src and target
        src = './app/index.html',
        targetDir = path.resolve(build ? 'www' : config.paths.target),

    // define the path for each build
        cssPath = path.resolve(build ? 'www/styles/main.css' : config.paths.target + '/styles/main.css'),
        vendorPath = path.resolve(build ? 'www/js/vendor.js' : config.paths.target + '/js/vendor.js'),
        appPath = path.resolve(build ? 'www/js/app.min.js'   : config.paths.target + '/js/app.min.js'),

    // define the stream for each build
        cssStream = gulp.src([cssPath], {read: false}),
        vendorStream = gulp.src([vendorPath], {read: false}),
        appStream = gulp.src([appPath], {read: false}),

    // define options to pass to the `inject` task
        options = {addRootSlash: false},
github russellf9 / f9-ionic-webrtc / gulp / tasks / build / vendor.js View on Github external
gulp.task('vendor', function() {

    var build = gulp.args.build || gulp.args.emulate || gulp.args.run,
        targetDir = path.resolve(build ? './www/' : config.paths.target);

    return gulp.src(gulp.vendorFiles,
        {base: 'bower_components/'})
        .pipe(gulp.plugins.concat('vendor.js'))
        .pipe(gulp.plugins.if(build, gulp.plugins.uglify())
            //.pipe(gulp.plugins.if(build, plugins.rev())) // could do this
            .pipe(gulp.dest(path.join(targetDir, 'js')))
            .on('error', errorHandler));
});
github russellf9 / f9-ionic-webrtc / gulp / tasks / build / build.js View on Github external
gulp.task('build', function(cb) {

    var build = gulp.args.build || gulp.args.emulate || gulp.args.run,
        emulate = gulp.args.emulate,
        run = gulp.args.run;

    // if we just use emulate or run without specifying platform, we assume iOS
    // in this case the value returned from yargs would just be true
    if (emulate === true) {
        emulate = 'ios';
    }
    if (run === true) {
        run = 'ios';
    }

    runSequence('clean',
        ['jshint', 'scripts', 'cti', 'api', 'vendor', 'styles', 'images'],
        'index', 'partials', 'fonts',
        build ? 'noop' : 'watchers',
github russellf9 / f9-ionic-webrtc / gulpfile.js View on Github external
args = require('yargs')
        .alias('e', 'emulate')
        .alias('b', 'build')
        .alias('r', 'run')
        .default('build', false)
        .default('port', 9000)
        .argv,

// Require all tasks in gulp/tasks, including subfolders
    tasks = requireDir('./gulp/tasks', {recurse: true});

// assign the plugins to the `cached response`
gulp.plugins = plugins;

// assign the args to the `cached response`
gulp.args = args;

// assign the list of all library js files
gulp.vendorFiles = require('./vendor.json');

// shared error handler
gulp.errorHandler = function(task, error) {
    gulp.plugins.util.log('Gulp - ', task, ' - error: ', plugins.colors.magenta(error));
};
github russellf9 / f9-ionic-webrtc / gulp / tasks / build / partials.js View on Github external
gulp.task('partials', function() {

    console.log('doing partials!')

    var build = gulp.args.build || gulp.args.emulate || gulp.args.run,
        src = './app/partials/**/*.html',
        targetDir = path.resolve(build ? './www/' : config.paths.target);

    gulp.src(src)
        .pipe(gulp.dest(path.join(targetDir, 'partials')));
});
github russellf9 / f9-ionic-webrtc / gulp / tasks / build / clean.js View on Github external
gulp.task('clean', function() {

    var build = gulp.args.build || gulp.args.emulate || gulp.args.run,
        targetDir = path.resolve(build ? './www' : config.paths.target);

    return gulp.src(targetDir)
        .pipe(gulp.plugins.clean({force: true, read: false})).on('error', errorHandler);
});
github russellf9 / f9-ionic-webrtc / gulp / tasks / build / styles.js View on Github external
gulp.task('styles', function() {

    var build = gulp.args.build || gulp.args.emulate || gulp.args.run,
        options = config.sass.options;

    options.style = build ? 'compressed' : 'expanded';

    var cssPaths = ['./bower_components/ionic/css/ionic.min.css',
        './bower_components/jquery-ui/themes/ui-lightness/jquery-ui.css'],
        sassStream = gulp.plugins.rubySass(config.sass.rubySrc, options)
            .pipe(gulp.plugins.autoprefixer(config.sass.autoprefixer))
            .on('error', errorHandler),
        cssStream = gulp.src(cssPaths),
        targetDir = path.resolve(build ? './www' : './.tmp');

    return streamqueue({objectMode: true}, cssStream, sassStream)
        .pipe(gulp.plugins.concat('main.css'))
        //.pipe(plugins.if(build, plugins.stripCssComments()))
        //.pipe(plugins.if(build, plugins.rev()))
github russellf9 / f9-ionic-webrtc / gulp / tasks / build / images.js View on Github external
gulp.task('images', function() {

    var build = gulp.args.build || gulp.args.emulate || gulp.args.run,
        targetDir = path.resolve(build ? './www/' : './.tmp/');

    return gulp.src(config.paths.images)
        .pipe(gulp.plugins.chmod(755))
        .pipe(gulp.dest(path.join(targetDir, 'img')))

        .on('error', function(error) {
            gulp.errorHandler('images', error);
        });
});
github russellf9 / f9-ionic-webrtc / gulp / tasks / build / fonts.js View on Github external
gulp.task('fonts', function(cb) {

    var build = gulp.args.build || gulp.args.emulate || gulp.args.run,
        targetDir = path.resolve(build ? 'www' : '.tmp'),
        fontDir = targetDir + '/fonts';

    gulp.src(['app/fonts/*.*', 'bower_components/ionic/fonts/*.*'])
        .pipe(gulp.dest(fontDir))
        .on('error', errorHandler);
    cb();
});