-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgulpfile.js
56 lines (48 loc) · 1.68 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
(function() {
var gulp = require('gulp'),
del = require('del'),
browserify = require('browserify'),
strictify = require('strictify'),
buffer = require('vinyl-buffer'),
ngHtml2Js = require('gulp-ng-html2js'),
minifyHtml = require('gulp-minify-html'),
source = require('vinyl-source-stream'),
uglify = require('gulp-uglify'),
sourcemaps = require('gulp-sourcemaps'),
concat = require('gulp-concat');
gulp.task('clean', function() {
return del('build');
});
gulp.task('build:html', function() {
return gulp.src('src/**/*.html')
.pipe(minifyHtml({
empty: true,
spare: true,
quotes: true
}))
.pipe(ngHtml2Js({
moduleName: 'app',
rename: function(url) {
return url.replace('src/', '');
}
}))
.pipe(concat("templates-nordwind.js"))
.pipe(uglify())
.pipe(gulp.dest('build/'));
});
gulp.task('build:js', function () {
return browserify('src/index.js', { transform: strictify })
.bundle()
.pipe(source('controllers-nordwind.js'))
.pipe(buffer())
.pipe(sourcemaps.init({loadMaps: true}))
.pipe(uglify())
.pipe(sourcemaps.write('./'))
.pipe(gulp.dest('build/'));
});
gulp.task('watch', function() {
gulp.watch('src/**/*.*', gulp.series('build:js', 'build:html'));
});
gulp.task('build', gulp.series('build:js', 'build:html'));
gulp.task('default', gulp.series('build', 'watch'));
}());