-
Notifications
You must be signed in to change notification settings - Fork 0
/
Gulpfile.js
59 lines (50 loc) · 1.53 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
59
var gulp = require('gulp'),
uglify = require('gulp-uglify'),
changed = require('gulp-changed')
imagemin = require('gulp-imagemin'),
stripDebug = require('gulp-strip-debug'),
minifyCSS = require('gulp-minify-css'),
minifyHTML = require('gulp-minify-html'),
browserify = require('gulp-browserify');
gulp.task('js', function () {
gulp.src('app/js/main.js')
.pipe(browserify())
.pipe(uglify({ compress: true }))
.pipe(stripDebug())
.pipe(gulp.dest('./public/js'));
});
gulp.task('js-dev', function () {
gulp.src('app/js/main.js')
.pipe(browserify())
.pipe(gulp.dest('./public/js'));
});
gulp.task('css', function () {
gulp.src('app/css/**/*.css')
.pipe(minifyCSS({ keepSpecialComments: '*', keepBreaks: '*'}))
.pipe(gulp.dest('./public/css'));
});
gulp.task('images', function () {
var imgSrc = './app/img/**/*',
imgDst = './public/img';
gulp.src('app/img/**/*')
.pipe(changed(imgDst))
.pipe(imagemin())
.pipe(gulp.dest(imgDst));
});
gulp.task('html', function () {
var htmlSrc = './app/*.html',
htmlDst = './public';
gulp.src(htmlSrc)
.pipe(minifyHTML())
.pipe(gulp.dest(htmlDst));
});
gulp.task('fonts', function () {
gulp.src('app/fonts/**')
.pipe(gulp.dest('./public/fonts'));
});
gulp.task('data', function () {
gulp.src('app/data.json')
.pipe(gulp.dest('./public'));
});
gulp.task('default', [ 'js-dev', 'css', 'images', 'html', 'fonts', 'data' ]);
gulp.task('prod', [ 'js', 'css', 'images', 'html', 'fonts', 'data' ]);