-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
98 lines (86 loc) · 2.4 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
92
93
94
95
96
97
98
/*jshint node: true */
'use strict';
var gulp = require('gulp'),
concat = require('gulp-concat'),
html2Js = require('gulp-ng-html2js'),
jshint = require('gulp-jshint'),
karma = require('karma').server,
minifyHtml = require('gulp-minify-html'),
path = require('path'),
rename = require('gulp-rename'),
uglify = require('gulp-uglify'),
rm = require('gulp-rm'),
ghpages = require('gulp-gh-pages'),
cp = require('child_process');
gulp.task('jshint', function() {
gulp.src([
'./gulpfile.js',
'./src/**/*.js'
])
.pipe(jshint())
.pipe(jshint.reporter('default'));
});
gulp.task('scripts', ['test'], function() {
return gulp.src([
'./src/ml-highcharts.js',
'./src/**/*.js'
])
.pipe(concat('ml-highcharts-ng.js'))
.pipe(gulp.dest('dist'))
.pipe(rename('ml-highcharts-ng.min.js'))
.pipe(uglify())
.pipe(gulp.dest('dist'));
});
gulp.task('templates', ['test'], function() {
return gulp.src([ './src/**/*.html' ])
.pipe(minifyHtml({
empty: true,
spare: true,
quotes: true
}))
.pipe(html2Js({
moduleName: 'ml.highcharts.tpls',
prefix: '/ml-highcharts/'
}))
.pipe(concat('ml-highcharts-ng-tpls.min.js'))
.pipe(uglify())
.pipe(gulp.dest('dist'));
});
gulp.task('test', function() {
karma.start({
configFile: path.join(__dirname, './karma.conf.js'),
singleRun: true,
autoWatch: false
}, function (exitCode) {
console.log('Karma has exited with ' + exitCode);
process.exit(exitCode);
});
});
gulp.task('autotest', function() {
karma.start({
configFile: path.join(__dirname, './karma.conf.js'),
autoWatch: true
}, function (exitCode) {
console.log('Karma has exited with ' + exitCode);
process.exit(exitCode);
});
});
gulp.task('docs', function() {
cp.exec('./node_modules/.bin/jsdoc -c jsdoc.conf.json', function(err) {
if (err) {
return console.log(err);
}
gulp.src([ './docs/generated/css/baseline.css', './docs/custom-styles.css' ])
.pipe(concat('baseline.css'))
.pipe(gulp.dest('./docs/generated/css'));
});
});
gulp.task('clean-docs', function() {
return gulp.src('./docs/generated/**/*', { read: false })
.pipe(rm({async: false}));
});
gulp.task('publish-docs', function() {
return gulp.src([ './docs/generated/**/*.*' ])
.pipe(ghpages());
});
gulp.task('default', ['jshint', 'scripts', 'templates']);