-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathgulpfile.ts
45 lines (37 loc) · 1.03 KB
/
gulpfile.ts
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
var gulp = require('gulp');
var webpack = require('webpack');
var minifyCss = require('gulp-minify-css');
var util = require('gulp-util');
gulp.task('minify-css', () => {
return gulp.src('src/assets/css/*.css')
.pipe(minifyCss({}))
.pipe(gulp.dest('assets/css/styles'));
});
gulp.task('default', [
'webpack',
'minify-css',
'snarkError'
]);
gulp.task('webpack', cb => {
var webpackConfig = {
context: process.cwd(),
entry: `./src/assets/js/index.js`,
output: {
path: `${__dirname}/assets/js`,
filename: 'app.js'
}
}
webpack(webpackConfig, (error, stats) => {
if (error) throw new Error('Failed to bundle: ' + error);
util.log('[webpack] successfully bundled')
});
cb();
});
gulp.task('snarkError', () => {
throw new SnarkError('Gulp encountered');
});
function SnarkError(message) {
this.name = 'SnarkError';
this.message = message || 'Undefined SnarkError encountered';
this.stack = (new Error()).stack;
}