-
Notifications
You must be signed in to change notification settings - Fork 44
/
gulpfile.js
79 lines (71 loc) · 2.03 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
var gulp = require('gulp');
var eslint = require('gulp-eslint');
var uglify = require('gulp-uglify');
var rename = require('gulp-rename');
var concat = require('gulp-concat');
var childFiles = [
'src/seamless.base.js',
'src/seamless.connection.js',
'src/seamless.child.js'
];
var parentFiles = [
'src/seamless.base.js',
'src/seamless.connection.js',
'src/seamless.parent.js'
];
gulp.task('lint', function () {
return gulp.src([
'src/seamless.base.js',
'src/seamless.child.js',
'src/seamless.connection.js',
'src/seamless.parent.js'
])
.pipe(eslint({
rules: {
'strict': 2
},
envs: [
'browser'
]
}))
.pipe(eslint.format())
.pipe(eslint.failAfterError());
});
gulp.task('scripts-child', function() {
return gulp.src(['lib/postmessage/postmessage.js'].concat(childFiles))
.pipe(concat('seamless.child.js'))
.pipe(gulp.dest('build/'))
.pipe(rename('seamless.child.min.js'))
.pipe(uglify())
.pipe(gulp.dest('build'));
});
gulp.task('scripts-child-nopm', function() {
return gulp.src(childFiles)
.pipe(concat('seamless.child.nopm.js'))
.pipe(gulp.dest('build/'))
.pipe(rename('seamless.child.nopm.min.js'))
.pipe(uglify())
.pipe(gulp.dest('build'));
});
gulp.task('scripts-parent', function() {
return gulp.src([
'lib/postmessage/postmessage.js',
'node_modules/custom-event-polyfill/custom-event-polyfill.js'
].concat(parentFiles))
.pipe(concat('seamless.parent.js'))
.pipe(gulp.dest('build/'))
.pipe(rename('seamless.parent.min.js'))
.pipe(uglify())
.pipe(gulp.dest('build'));
});
gulp.task('scripts-parent-nopm', function() {
return gulp.src(parentFiles)
.pipe(concat('seamless.parent.nopm.js'))
.pipe(gulp.dest('build/'))
.pipe(rename('seamless.parent.nopm.min.js'))
.pipe(uglify())
.pipe(gulp.dest('build'));
});
gulp.task('scripts', ['scripts-child', 'scripts-child-nopm', 'scripts-parent', 'scripts-parent-nopm']);
gulp.task('build', ['lint', 'scripts']);
gulp.task('default', ['build']);