gulp.task(taskName, function () { var file = bundle.get('copytoclipboard.file'), files = bundle.get('copytoclipboard.files'), classOfFiles = sjl.classOf(files), classOfFile = sjl.classOf(file), src; // Message 'Running task' console.log(chalk.cyan('Running "' + taskName + '" task.\n')); if (classOfFile === 'String' || file.length > 0) { src = file; } else if ((classOfFiles === 'String' || classOfFiles === 'Array') && files.length > 0) { src = files; } else if (classOfFiles === 'Object') { throw new Error ('no support for files hash object yet.'); } else { throw new Error ('No valid "file" or "files" key found for task "' + taskName + '".'); } return gulp.src(src) .pipe(gulpCopyToClipboard()) .pipe(gulpDuration(chalk.cyan('"' + taskName + '" duration: '))); }); // end of copytoclipboard task
gulp.task('build-svg', function() { return gulp.src(path.assets.src) .pipe(cache('svg')) .pipe(imagemin()) .pipe(urlencode()) .pipe(rename(function(path) { path.basename = 'icon'; })) .pipe(clipboard()) .pipe(gulp.dest(path.assets.dest)) .pipe(browserSync.stream()); });