-
Notifications
You must be signed in to change notification settings - Fork 8
/
gulpfile.js
128 lines (112 loc) · 3.05 KB
/
gulpfile.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
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
'use strict';
import gulp from 'gulp';
import yargs from 'yargs';
// import requireDir from 'require-dir';
import c from 'ansi-colors';
import { resolve } from 'path';
const __dirname = resolve();
const argv = yargs().argv;
const production = !!argv.production;
if (production) {
console.log(c.green.bold.underline('🚚 Production mode'));
} else {
console.log(c.yellow.bold.underline('🔧 Development mode'));
}
const paths = {
dist: './dist/',
views: {
src: './src/views/templates/**/*.html',
pages: './src/views/templates/',
partials: './src/views/partials/',
helpers: './src/views/helpers/',
data: './src/views/data',
dist: './dist/',
watch: './src/views/**/*.{html,hbs}',
},
styles: {
src: './src/styles/*.{scss,sass}',
dist: './dist/assets/styles/',
watch: './src/styles/**/*.{scss,sass}',
},
fonts: {
src: './src/fonts/**/*.{woff,woff2,eot,ttf,svg}',
dist: './dist/assets/fonts/',
watch: './src/fonts/**/*.{woff,woff2,eot,ttf,svg}',
},
favicons: {
src: "./src/img/favicon/*.{jpg,jpeg,png,gif}",
dist: "./dist/assets/img/favicons/",
},
sprites: {
src: "./src/img/svg-sprite/*.svg",
dist: "./dist/assets/img/svg-sprite/",
watch: "./src/img/svg-sprite/*.svg"
},
images: {
src: [
'./src/img/**/*.{jpg,jpeg,png,gif,tiff,svg}',
'!./src/img/favicon/*',
'!./src/img/svg-sprite/*',
],
dist: './dist/assets/img/',
watch: './src/img/**/*.{jpg,jpeg,png,gif,svg,tiff}',
},
scripts: {
src: './src/js/main.js',
dist: './dist/assets/js/',
srcOther: './src/js/other/*.js',
distOther: './dist/assets/js/other/',
watch: './src/js/**/*.js',
},
vendors: {
src: './src/vendors/**/*.*',
dist: './dist/assets/vendors/'
},
assets: {
dist: './dist/assets/',
},
};
const config = {
production: production,
plumber: {
errorHandler: function(error) {
console.log(c.red(error.message));
this.emit('end');
}
},
fileInclude: {
prefix: '@@',
basepath: __dirname,
context: {},
},
metadata: {
author: 'Maksim Abuzyarov',
year: (new Date()).getFullYear()
}
};
// -------------------------------------
// All tasks
// -------------------------------------
import './tasks/clean.js';
import './tasks/favicons.js';
import './tasks/fonts.js';
import './tasks/images.js';
import './tasks/notify.js';
import './tasks/scripts.js';
import './tasks/sprites.js';
import './tasks/styles.js';
import './tasks/vendors.js';
import './tasks/views.js';
import './tasks/webserver.js';
// -------------------------------------
// Task: default
// -------------------------------------
gulp.task('default',
gulp.series(gulp.parallel('styles', 'scripts', 'images', 'fonts', 'views', 'favicons', 'sprites', 'vendors'), 'server'));
// -------------------------------------
// Task: build
// -------------------------------------
gulp.task(
'build',
gulp.series('clean', gulp.parallel('styles', 'scripts', 'images', 'fonts', 'views', 'favicons', 'sprites', 'vendors'), 'say:build'));
export { paths, config };