-
Notifications
You must be signed in to change notification settings - Fork 4
/
gulpfile.js
72 lines (63 loc) · 1.75 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
const gulp = require('gulp');
const webpack = require('webpack-stream');
require('babel-loader');
require('html-loader');
const sass = require('gulp-sass');
const maps = require('gulp-sourcemaps');
const minifyCss = require('gulp-minify-css');
gulp.task('html:dev', () => {
gulp.src(__dirname + '/app/**/*.html')
.pipe(gulp.dest(__dirname + '/build'));
});
gulp.task('css:dev', () => {
gulp.src(__dirname + '/app/**/*.css')
.pipe(gulp.dest(__dirname + '/build'));
});
gulp.task('sass:dev', () => {
gulp.src(__dirname + '/app/**/*.scss')
.pipe(maps.init())
.pipe(sass().on('error', sass.logError))
.pipe(minifyCss())
.pipe(maps.write('./'))
.pipe(gulp.dest(__dirname + '/build'));
});
gulp.task('images:dev', () => {
gulp.src(__dirname + '/app/images/**/*')
.pipe(gulp.dest(__dirname + '/build/images'));
});
gulp.task('favicon:dev', () => {
gulp.src(__dirname + '/favicon.ico')
.pipe(gulp.dest(__dirname + '/build/'));
});
gulp.task('webpack:dev', () => {
gulp.src('./app/js/client.js')
.pipe(webpack({
output: {
filename: 'bundle.js'
}
}))
.pipe(gulp.dest(__dirname + '/build'));
});
gulp.task('webpack:test', () => {
gulp.src(__dirname + '/app/test/test_entry.js')
.pipe(webpack({
module: {
loaders: [
{
test: /\.html$/,
loader: 'html'
}
]
},
output: {
filename: 'test_bundle.js'
}
}))
.pipe(gulp.dest(__dirname + '/app/test/bndl/'));
});
gulp.task('run:tests', () => {
// placeholder for a new task to run a battery of tests.
});
gulp.task('build:dev', ['webpack:dev', 'html:dev', 'css:dev',
'sass:dev', 'images:dev', 'favicon:dev']);
gulp.task('default', ['build:dev', 'webpack:test']);