Skip to content

Instantly share code, notes, and snippets.

@jamiebuilds
Created October 5, 2015 20:45
Show Gist options
  • Save jamiebuilds/9fd93d3893e2cbd78329 to your computer and use it in GitHub Desktop.
Save jamiebuilds/9fd93d3893e2cbd78329 to your computer and use it in GitHub Desktop.
Example multi-file gulp setup
export lint from './task-lint';
export test from './task-test';
export build from './task-build';
export dev from './task-dev';
export default dev;
import {src, dest, series} from 'gulp';
import buildPlugin from 'gulp-build-plugin';
import {SRC_DIRECTORY, DIST_DIRECTORY} from './task-constants';
import test from './task-test';
const buildFiles = () => src(SRC_DIRECTORY)
.pipe(buildPlugin())
.pipe(dest(DIST_DIRECTORY));
export default series(test, buildFiles);
export const SRC_DIRECTORY = './src';
export const TEST_DIRECTORY = './test';
export const DIST_DIRECTORY = './dist';
import {watch, parallel} from 'gulp';
import {SRC_DIRECTORY, TEST_DIRECTORY} from './task-constants';
import test from './task-test';
import build from './task-build';
export default () => {
watch(SRC_DIRECTORY, parallel(test, build));
watch(TEST_DIRECTORY, test);
};
import {src, parallel} from 'gulp';
import lintPlugin from 'gulp-lint-plugin';
import {SRC_DIRECTORY, TEST_DIRECTORY} from './task-constants';
const lintDir = dir => src(dir)
.pipe(lintPlugin());
const lintSrc = () => lintDir(SRC_DIRECTORY);
const lintTest = () => lintDir(TEST_DIRECTORY);
const lintFiles = parallel(lintSrc, lintTest);
export const reportLint = () => lintPlugin.report();
export default series(lintFiles, reportLint);
import {src, parallel, series} from 'gulp';
import testPlugin from 'gulp-test-plugin';
import {TEST_DIRECTORY} from './task-constants';
import {reportLint}, lint from './task-lint';
const testFiles = () => src(TEST_DIRECTORY)
.pipe(testPlugin());
const reportTest = () => testPlugin.report();
const reportLintAndTest = series(reportLint, reportTest);
export default series(parallel(lint, testFiles), reportLintAnTest);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment