-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
91 lines (72 loc) · 2.24 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
'use strict';
const gulp = require('gulp');
const rename = require('gulp-rename');
const browserify = require('gulp-browserify');
const uglify = require('gulp-uglify');
const concat = require('gulp-concat');
const babel = require('gulp-babel');
const prefix = require('gulp-autoprefixer');
const minifyCSS = require('gulp-clean-css');
const jshint = require('gulp-jshint');
const del = require('del');
const pump = require('pump');
gulp.task('clean', function() {
return del.sync([
'./dist/style/*',
'./dist/template/*',
'/dist/*'
]);
});
gulp.task('lint-client', () => {
return gulp.src('./client/**/*.js')
.pipe(jshint())
.pipe(jshint.reporter('default'));
});
gulp.task('browserify-client', ['lint-client'], (cb) => {
pump([
gulp.src(['client/index.js']),
browserify(
{
insertGlobals: true,
debug: true
}),
babel({presets: ['es2015']}),
concat('packagy.min.js'),
//uglify(),
gulp.dest('build/')
], cb);
});
gulp.task('watch', () => {
gulp.watch('client/**/*.js', ['browserify-client']);
gulp.watch(['client/*.html', 'client/template/**/*.html'], ['views']);
gulp.watch('client/**/*.css', ['styles-css']);
gulp.watch('client/style/assets/*', ['assets']);
});
gulp.task('views', () => {
//move the top level html files
gulp.src('client/*.html')
.pipe(gulp.dest('build/'));
//move template files, preserve file structure
gulp.src(['./client/template/**/*.html'], {
base: './client/template/'
})
.pipe(gulp.dest('build/template'));
});
gulp.task('module-css', () => {
return gulp.src('./node_modules/angular-material/angular-material.min.css')
.pipe(gulp.dest('build/style'));
});
gulp.task('styles-css', ['module-css'] ,() => {
return gulp.src('client/style/*.css')
.pipe(prefix({
cascade: true
}))
.pipe(minifyCSS())
.pipe(gulp.dest('build/style'));
});
gulp.task('assets', () => {
return gulp.src('client/style/assets/*')
.pipe(gulp.dest('build/style/assets'));
})
gulp.task('build', ['views', 'browserify-client', 'styles-css', 'assets']);
gulp.task('default', ['clean', 'build', 'watch']);