-
Notifications
You must be signed in to change notification settings - Fork 2
/
gulpfile.js
51 lines (42 loc) · 1.24 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
var gulp = require('gulp');
var webpack = require('gulp-webpack');
var rename = require("gulp-rename");
var jshint = require('gulp-jshint');
var uglify = require('gulp-uglify');
var plumber = require('gulp-plumber');
var path = require('path');
// Root directory
var rootDirectory = path.resolve('./');
// Source directory for build process
var sourceDirectory = path.join(rootDirectory, './src');
var sourceFiles = [
path.join(sourceDirectory, '/*.js')
];
var libraryName = 'kclass';
gulp.task('build', function() {
return gulp.src(sourceDirectory + '/' + libraryName + '.js')
.pipe(webpack({
output: {
filename: libraryName + '.js',
path: __dirname,
library: "Kclass",
libraryTarget: 'umd'
}
}))
.pipe(gulp.dest('dist/'))
.pipe(uglify())
.pipe(rename(libraryName + '.min.js'))
.pipe(gulp.dest('dist/'));
});
/**
* Validate source JavaScript
*/
gulp.task('jshint-src', function () {
return gulp.src(sourceFiles)
.pipe(plumber())
.pipe(jshint({
reporter: 'default'
}))
//.pipe(jshint.reporter('jshint-stylish'))
});
gulp.task('default',['jshint-src', 'build']);