forked from paragonie/airship
-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
126 lines (113 loc) · 3.37 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
/**
* Used Modules Inside Of Build Process
*/
const gulp = require('gulp'),
sass = require('gulp-sass'),
babel = require('gulp-babel'),
concat = require('gulp-concat'),
uglify = require('gulp-uglify'),
uglifycss = require('gulp-uglifycss'),
rename = require('gulp-rename');
/**
* Configures Environment For Build Process
*/
const bridgeScssPath = 'src/Cabin/Bridge/public/src/scss',
bridgeCompiledCSSPath = 'src/Cabin/Bridge/public/css',
bridgeJSPath = 'src/Cabin/Bridge/public/src/js',
bridgeCompiledJSPath = 'src/Cabin/Bridge/public/js',
hullScssPath = 'src/Cabin/Hull/public/src/scss',
hullCompiledCSSPath = 'src/Cabin/Hull/public/css',
hullJSPath = 'src/Cabin/Hull/public/src/js',
hullCompiledJSPath = 'src/Cabin/Hull/public/js';
/**
* Runs all of the build steps for the bridge
*/
gulp.task('bridge-styles', () => {
return gulp
.src(bridgeScssPath + '/bridge.scss')
.pipe(sass().on('error', sass.logError))
.pipe(gulp.dest(bridgeCompiledCSSPath))
});
gulp.task('bridge-scripts', () => {
return gulp
.src(bridgeJSPath + '/**/*.js')
.pipe(concat('bridge.js'))
.pipe(babel({
presets: ['es2015']
}))
.pipe(gulp.dest(bridgeCompiledJSPath))
});
gulp.task('uglify-bridge-styles', () => {
return gulp
.src(bridgeCompiledCSSPath + '/bridge.css')
.pipe(uglifycss())
.pipe(rename('bridge.min.css'))
.pipe(gulp.dest(bridgeCompiledCSSPath))
});
gulp.task('uglify-bridge-scripts', () => {
return gulp
.src(bridgeCompiledJSPath + '/bridge.js')
.pipe(uglify())
.pipe(rename('bridge.min.js'))
.pipe(gulp.dest(bridgeCompiledJSPath))
});
/**
* Runs all of the build steps for the hull
*/
gulp.task('hull-styles', () => {
return gulp
.src(hullScssPath + '/hull.scss')
.pipe(sass().on('error', sass.logError))
.pipe(gulp.dest(hullCompiledCSSPath))
});
gulp.task('hull-scripts', () => {
return gulp
.src(hullJSPath + '/**/*.js')
.pipe(concat('hull.js'))
.pipe(babel({
presets: ['es2015']
}))
.pipe(gulp.dest(hullCompiledJSPath))
});
gulp.task('uglify-hull-styles', () => {
return gulp
.src(hullCompiledCSSPath + '/hull.css')
.pipe(uglifycss())
.pipe(rename('hull.min.css'))
.pipe(gulp.dest(hullCompiledCSSPath))
});
gulp.task('uglify-hull-scripts', () => {
return gulp
.src(hullCompiledJSPath + '/hull.js')
.pipe(uglify())
.pipe(rename('hull.min.js'))
.pipe(gulp.dest(hullCompiledJSPath))
});
/**
* Launches All Watch Functions
*/
gulp.task('default', function () {
gulp.watch(bridgeScssPath + '/**/*.scss', ['bridge-styles']);
gulp.watch(bridgeJSPath + '/**/*.js', ['bridge-scripts']);
gulp.watch(hullScssPath + '/**/*.scss', ['hull-styles']);
gulp.watch(hullJSPath + '/**/*.js', ['hull-scripts']);
});
/**
* Build Commands For Each Section
*/
gulp.task('build-bridge', [
'bridge-styles',
'bridge-scripts',
'uglify-bridge-styles',
'uglify-bridge-scripts',
]);
gulp.task('build-hull', [
'hull-styles',
'hull-scripts',
'uglify-hull-styles',
'uglify-hull-scripts',
]);
gulp.task('build', [
'build-bridge',
'build-hull',
]);