-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
96 lines (81 loc) · 2.57 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
var gulp = require('gulp');
var sass = require('gulp-sass');
var rename = require('gulp-rename');
var concat = require('gulp-concat');
var autoPrefixer = require('gulp-autoprefixer');
gulp.task('scss', function() {
return gulp.src('src/notifyMe.scss')
.pipe(sass().on('error', sass.logError))
.pipe(autoPrefixer({
browsers: ['last 2 versions', 'ie >= 9', 'and_chr >= 2.3']
}))
.pipe(rename('notify-me.css'))
.pipe(gulp.dest('build'));
});
gulp.task('scss:min', function() {
var minify = require('gulp-minify-css');
return gulp.src('src/notifyMe.scss')
.pipe(sass().on('error', sass.logError))
.pipe(autoPrefixer({
browsers: ['last 2 versions', 'ie >= 9', 'and_chr >= 2.3']
}))
.pipe(rename('notify-me.min.css'))
.pipe(minify())
.pipe(gulp.dest('build'));
});
gulp.task('scripts', function() {
return gulp.src(['src/notifyMe.js', 'src/**/*.js'])
.pipe(concat('notifyMe.js'))
.pipe(gulp.dest('build'));
});
gulp.task('scripts:min', function() {
var uglify = require('gulp-uglify');
return gulp.src(['src/notifyMe.js', 'src/**/*.js'])
.pipe(concat('notifyMe.min.js'))
.pipe(uglify())
.pipe(gulp.dest('build'));
});
gulp.task('watch', function() {
gulp.watch('src/**/*.js', ['scripts']);
gulp.watch('src/notifyMe.scss', ['scss']);
});
gulp.task('clean', function() {
var del = require('del');
del('build');
// del('docs');
});
gulp.task('build', ['clean', 'scss', 'scripts', 'buildDocs']);
gulp.task('test', startTest(true));
gulp.task('test:watch', startTest(false));
gulp.task('buildDocs', [], function () {
var gulpDocs = require('gulp-ngdocs');
var options = {
html5Mode: true,
startPage: '/api/notifyMe.notifyMe',
title: "notifyMe Docs",
titleLink: "/api/notifyMe"
};
return gulp.src('src/*.js')
.pipe(gulpDocs.process(options))
.pipe(gulp.dest('./docs'));
});
gulp.task('runDocs', function() {
var connect = require('gulp-connect');
connect.server({
root: 'docs',
livereload: false,
fallback: 'docs/index.html',
port: 8083
});
});
function startTest(singleRun) {
var Server = require('karma').Server;
return function (done) {
new Server({
configFile: __dirname + '/karma.conf.js',
singleRun: singleRun
}, function(exitResult) {
done(exitResult ? 'There are failing unit tests.' : undefined );
}).start();
}
}