forked from goodlyjunk/annotator-content-analysis
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgulpfile.babel.js
More file actions
67 lines (59 loc) · 1.65 KB
/
Copy pathgulpfile.babel.js
File metadata and controls
67 lines (59 loc) · 1.65 KB
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
import gulp from 'gulp';
import sass from 'gulp-sass';
import babel from 'gulp-babel';
import autoprefixer from 'gulp-autoprefixer';
import livereload from 'gulp-livereload';
import sourcemaps from 'gulp-sourcemaps';
import plumber from 'gulp-plumber';
import testem from 'gulp-testem';
import http from 'http';
import del from 'del';
const paths = {
js: ['src/**/*.js', 'spec/**/*.js'],
sass: 'style/**/*.scss',
dev: '.tmp',
dist: 'lib'
};
gulp.task('default', ['compile:js', 'compile:sass', 'watch'], () => {});
gulp.task('watch', () => {
livereload.listen();
gulp.watch(paths.js, ['compile:js']);
gulp.watch(paths.sass, ['compile:sass']);
});
gulp.task('clean', (callback) => {
return del([paths.dev], callback);
});
gulp.task('test', ['coverage'], () => {
gulp.src([''])
.pipe(testem({
configFile: 'testem.json'
})
);
});
gulp.task('compile:js', () => {
return gulp.src(paths.js)
.pipe(plumber())
.pipe(sourcemaps.init())
.pipe(babel({modules: 'commonStrict', comments: true}))
.pipe(sourcemaps.write())
.pipe(gulp.dest(paths.dev))
.pipe(livereload());
});
gulp.task('compile:sass', () => {
return gulp.src(paths.sass)
.pipe(sourcemaps.init())
.pipe(sass.sync().on('error', sass.logError))
.pipe(autoprefixer())
.pipe(sourcemaps.write('.'))
.pipe(gulp.dest(paths.dev))
.pipe(livereload());
});
gulp.task('coverage', () => {
const coverageServer = http.createServer((req, resp) => {
req.pipe(fs.createWriteStream('coverage.json'))
resp.end()
});
const port = 7358;
coverageServer.listen(port);
console.log("Coverage Server Started on port", port);
});