-
Notifications
You must be signed in to change notification settings - Fork 96
/
gulpfile.js
44 lines (40 loc) · 1.29 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
/**
* Created by aleksejs.gordejevs on 10/20/2016.
*/
var gulp = require('gulp');
var pathToLib = './lib/';
var size = require('gulp-filesize');
var sourcemaps = require('gulp-sourcemaps');
var uglify = require('gulp-uglify');
var rename = require('gulp-rename');
var concat = require('gulp-concat');
var rimraf = require('gulp-rimraf');
var jshint = require('gulp-jshint');
var gulpFilter = require('gulp-filter');
gulp.task('clean-js', function() {
var filter = gulpFilter(['**/*.min.js','**/*.js.map']);
return gulp.src(pathToLib + '**', {read: false})
.pipe(filter)
.pipe(rimraf({force: true}));
});
gulp.task('uglify-js', gulp.series('clean-js', function() {
var filter = gulpFilter(['*/*.js', '!*.min.js']);
return gulp.src(pathToLib + '*')
.pipe(filter)
//.pipe(sourcemaps.init({loadMaps: true}))
.pipe(uglify({mangle: false}))
.pipe(rename({suffix: '.min'}))
.pipe(size())
//.pipe(sourcemaps.write('./'))
.pipe(gulp.dest(pathToLib));
})
);
gulp.task('jshint', function() {
var filter = gulpFilter(['/*.js', '!*.min.js']);
return gulp.src(pathToLib)
.pipe(filter)
.pipe(jshint())
.pipe(size())
.pipe(jshint.reporter('default'));
});
gulp.task('default', gulp.series('jshint', 'uglify-js'));