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