-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgulpfile.babel.js
More file actions
83 lines (73 loc) · 1.85 KB
/
Copy pathgulpfile.babel.js
File metadata and controls
83 lines (73 loc) · 1.85 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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
'use strict';
import gulp from 'gulp';
import autoprefixer from 'gulp-autoprefixer';
import babel from 'gulp-babel';
import browserify from 'browserify';
import browserSync from 'browser-sync';
import concat from 'gulp-concat';
import source from 'vinyl-source-stream';
import eslint from 'gulp-eslint';
import babelify from 'babelify';
import gulpSequence from 'gulp-sequence';
import nsp from 'gulp-nsp';
const AUTOPREFIXER_BROWSERS = [
'ie >= 10',
'ie_mob >= 10',
'ff >= 30',
'chrome >= 34',
'safari >= 7',
'opera >= 23',
'ios >= 7',
'android >= 4.4',
'bb >= 10'
];
gulp.task('default', ['dist'], () => {
});
gulp.task('lint', () => {
return gulp.src(['src/**/*.js', '!node_modules/**'])
.pipe(eslint())
.pipe(eslint.format())
.pipe(eslint.failAfterError());
});
gulp.task('styles', () => {
return gulp.src(['src/styles/**'])
.pipe(autoprefixer(AUTOPREFIXER_BROWSERS))
.pipe(concat('onedrive-file-picker.css'))
.pipe(gulp.dest('dist'));
});
gulp.task('build', ['lint', 'styles'], () => {
return browserify({
entries: ['src/index.js'],
standalone: 'OneDriveFilePicker',
})
.transform(babelify)
.bundle()
.pipe(source('onedrive-file-picker.js'))
.pipe(gulp.dest('dist'));
});
gulp.task('install', ['nsp', 'build']);
gulp.task('nsp', (done) => {
nsp({ package: __dirname + '/package.json' }, done);
});
gulp.task('demo', ['build'], function() {
browserSync({
port: 5000,
notify: false,
logPrefix: 'PSK',
snippetOptions: {
rule: {
match: '<span id="browser-sync-binding"></span>',
fn: function(snippet) {
return snippet;
}
}
},
https: true,
server: {
baseDir: ["demo", "dist"],
files: ["demo", "dist"]
}
});
gulp.watch(['demo/*'], browserSync.reload);
gulp.watch(['src/**'], ['build', browserSync.reload]);
});