-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathgulpfile.babel.js
93 lines (84 loc) · 2.42 KB
/
gulpfile.babel.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
"use strict";
// GUlp is a simple platform-agnostic toolkit that helps you automate painful
// and time-consuming tasks in your workflow
import gulp from "gulp";
import gulpEslint from "gulp-eslint";
// browser-sync - Live CSS Reload & Browser Syncing
import browserSyncLib from "browser-sync";
// minimist - argument parser without all the fanciful decoration
import minimist from "minimist";
// gulp-load-plugins - Loads gulp plugins from package dependencies and attaches
// them to an object of your choice.
import gulpLoadPlugins from "gulp-load-plugins";
// Import package.json to grab and use the config property
import packageJsonData from "./package.json";
import clean from "./gulp/clean";
import copy from "./gulp/copy";
import copyIcon from "./gulp/copy-icon";
import deploy from "./gulp/deploy";
import font from "./gulp/font";
import image from "./gulp/image";
import pug from "./gulp/pug";
import sass from "./gulp/sass";
import template from "./gulp/template";
import watch from "./gulp/watch";
const config = Object.assign({}, packageJsonData.config);
const args = minimist(process.argv.slice(2));
const dir = config.directory;
const taskTarget = args.production ? dir.production : dir.development;
// Create a new browserSync instance
const browserSync = browserSyncLib.create();
// Load gulp plugins
const plugins = gulpLoadPlugins({
// when set to true, the plugin will log info to console.
// Useful for bug reporting and issue debugging
DEBUG: false
});
// Read all files from the gulp folder and load all gulp tasks
// fs.readdirSync('./gulp')
// .filter(fileName => /\.(js)$/i.test(fileName))
// .map(fileName => fileName.split('.').reduce(a=>a)());
const taskOptionList = { gulp, config, args, taskTarget, plugins, browserSync };
clean(taskOptionList);
copy(taskOptionList);
copyIcon(taskOptionList);
deploy(taskOptionList);
font(taskOptionList);
image(taskOptionList);
pug(taskOptionList);
sass(taskOptionList);
template(taskOptionList);
watch(taskOptionList);
// Server task with watch
gulp.task(
"dev",
gulp.series(
"clean:development",
"font",
"copy",
"copyIcon",
"image",
"sass",
"pug",
"template",
"watch"
)
);
// Build production ready code
gulp.task(
"build",
gulp.series(
"clean:production",
"font",
"copy",
"copyIcon",
"image",
"sass",
"pug",
"template"
)
);
// Default gulp task
gulp.task("default", () => {
console.log("Default gulp task");
});