-
Notifications
You must be signed in to change notification settings - Fork 213
/
gulpfile.js
53 lines (46 loc) · 1.28 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
var gulp = require('gulp');
var del = require('del');
var inject = require('gulp-inject');
var runSequence = require('run-sequence');
var concat = require('gulp-concat');
var uglify = require('gulp-uglify');
var rename = require("gulp-rename");
var sourceMaps = require('gulp-sourcemaps');
gulp.task('default', function (callback) {
runSequence('build',
'watch',
callback);
});
gulp.task('vendor', function () {
return gulp.src(['./node_modules/bodymovin/build/player/bodymovin.min.js'])
.pipe(gulp.dest('dist/vendor/'));
});
gulp.task('js', function () {
return gulp.src(['./src/js/titanic.js'])
.pipe(sourceMaps.init())
.pipe(concat('titanic.js'))
.pipe(uglify())
.pipe(rename({
suffix: '.min'
}))
.pipe(sourceMaps.write('../maps'))
.pipe(gulp.dest('dist/js/'));
});
gulp.task('images', function () {
return gulp.src('src/icons/*')
.pipe(gulp.dest('dist/icons/'));
});
// Cleans all /dist
gulp.task('clean', function () {
console.log('Cleaning...');
return del('dist/*');
});
gulp.task('build', function (callback) {
runSequence('clean', ['images', 'vendor', 'js'],
callback);
});
gulp.task('watch', function () {
gulp.watch('src/js/*.js', ['js']);
gulp.watch('src/images/*', ['images']);
gulp.watch('gulpfile.js', ['build']);
});