-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathgulpfile.js
52 lines (46 loc) · 1.47 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
var gulp = require('gulp'),
del = require('del'),
browserSync = require('browser-sync').create(),
concat = require('gulp-concat'),
deleteLines = require('gulp-delete-lines'),
paths = {
src: [
'./lib/**',
'./src/**'
],
example: './example/node_modules/ng2-simple-components',
exampleClean: [
'./example/node_modules/ng2-simple-components/lib',
'./example/node_modules/ng2-simple-components/src'
],
declarations: {
src: './lib/**/**.d.ts',
fileName: 'components.d.ts',
dest: './'
}
};
gulp.task('clean', () => {
return del(paths.exampleClean)
});
gulp.task('move-example', ['clean'], () => {
return gulp.src(paths.src, { base: './' }).pipe(gulp.dest(paths.example))
});
gulp.task('concat-dts', () => {
return gulp.src(paths.declarations.src)
.pipe(concat(paths.declarations.fileName))
.pipe(deleteLines({
'filters': [/^(import)((?!@angular).)*$/i]
}))
.pipe(gulp.dest(paths.declarations.dest));
});
gulp.task('serve', ['move-example'], () => {
browserSync.init({
server: {
baseDir: "./example/",
index: "index.html"
}
});
gulp.watch(paths.src, ['move-example']);
gulp.watch(paths.example + '/app/**/**').on('change', browserSync.reload);
gulp.watch(paths.example + '/node_modules/**/**').on('change', browserSync.reload);
});