-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
60 lines (50 loc) · 1.78 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
(function () {
var gulp = require('gulp'),
del = require('del'),
browserify = require('browserify'),
strictify = require('strictify'),
buffer = require('vinyl-buffer'),
source = require('vinyl-source-stream'),
sourcemaps = require('gulp-sourcemaps'),
ngHtml2Js = require('gulp-ng-html2js'),
minifyHtml = require('gulp-minify-html'),
uglify = require('gulp-uglify'),
concat = require('gulp-concat'),
stylus = require('gulp-stylus'),
autoprefixer = require('autoprefixer-stylus');
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-redwings.js"))
.pipe(uglify())
.pipe(gulp.dest('build/'));
});
gulp.task('build:js', function () {
return browserify('src/index.js', {transform: strictify})
.bundle()
.pipe(source('controllers-redwings.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:html', 'build:js'));
});
gulp.task('build', gulp.series('build:html', 'build:js'));
gulp.task('default', gulp.series('build', 'watch'));
}());