-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
74 lines (68 loc) · 1.8 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
var gulp = require('gulp');
var $ = require('gulp-load-plugins')();
var browserSync = require('browser-sync');
var reload = browserSync.reload;
gulp.task('jshint', function () {
return gulp.src('./src/**/*.js')
.pipe($.jshint())
.pipe($.jshint.reporter('jshint-stylish'));
});
gulp.task('js', function () {
return gulp.src([
'./src/module.js',
'./src/services/*.js'
]).pipe($.concat('govright-platform-services.js'))
.pipe($.replace(/'use strict';\n/g, ''))
.pipe($.wrap('(function(){\'use strict\';\n<%= contents %>})();'))
.pipe(gulp.dest('./dist'))
.pipe($.uglify())
.pipe($.rename({
extname: '.min.js'
}))
.pipe(gulp.dest('./dist'));
});
gulp.task('docs-html', function () {
return $.ngdocs.sections({
api: {
glob: ['./dist/govright-platform-services.js'],
api: true,
title: 'API Reference'
}
}).pipe($.ngdocs.process({
startPage: '/api/govright.platformServices',
html5Mode: false,
title: 'GovRight Platform Services',
styles: [ 'bower_components/gulp-ngdocs-supplemental/dist/style.css' ],
navTemplate: './ngdocs_assets/navbar.html'
}))
.pipe(gulp.dest('./docs'));
});
gulp.task('serve', ['default'], function () {
browserSync({
notify: false,
port: 9000,
server: {
baseDir: ['./docs']
}
});
gulp.watch([
'./dist/govright-platform-services.js',
'./docs/partials/**/*',
'./docs/css/**/*'
]).on('change', reload);
gulp.watch([
'./dist/govright-platform-services.js',
'./ngdocs_assets/**/*'
], ['docs-html']);
gulp.watch([
'./src/**/*.js'
], ['js']);
});
gulp.task('docs', function() {
return require('del')(['./docs']).then(function() {
return gulp.start('docs-html');
});
});
gulp.task('default', ['js'], function() {
return gulp.start('docs');
});