-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathgulpfile.js
58 lines (50 loc) · 1.37 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
const gulp = require('gulp'),
sourcemaps = require('gulp-sourcemaps'),
autoprefixer = require('gulp-autoprefixer'),
concat = require('gulp-concat'),
del = require('del'),
path = require('path'),
jspm = require('gulp-jspm'),
rename = require('gulp-rename'),
KarmaServer = require('karma').Server;
const options = {
buildDir: 'dist/',
};
gulp.task('css', () => {
return gulp.src('src/*.css')
.pipe(sourcemaps.init())
.pipe(autoprefixer({
browsers: ['last 2 versions'],
cascade: false,
}))
.pipe(sourcemaps.write('.'))
.pipe(gulp.dest(options.buildDir));
});
gulp.task('javascript', () => {
return gulp.src('src/virtual-select-jquery.js')
.pipe(sourcemaps.init())
.pipe(jspm({
selfExecutingBundle: true,
minify: true,
}))
.pipe(rename('virtual-select-jquery.min.js'))
.pipe(sourcemaps.write('.'))
.pipe(gulp.dest(options.buildDir));
});
gulp.task('test', (done) => {
new KarmaServer({
configFile: __dirname + '/karma.conf.js',
singleRun: true,
browsers: ['PhantomJS'],
}, done).start();
});
gulp.task('clean', () => {
return del([options.buildDir]);
});
gulp.task('build', ['css', 'javascript']);
gulp.task('develop', ['build'], () => {
gulp.watch('src/**/*.css', ['css']);
gulp.watch('src/**/*.js', ['javascript']);
});
gulp.task('release', ['build']);
gulp.task('default', ['develop']);