-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgulpfile.js
63 lines (54 loc) · 1.65 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
60
61
62
63
var gulp = require('gulp'),
sass = require('gulp-sass'),
htmlmin = require('gulp-htmlmin'),
uglify = require('gulp-uglify'),
concat = require('gulp-concat'),
clean = require('gulp-clean'),
imgmin = require('gulp-imagemin'),
cache = require('gulp-cache'),
useref = require('gulp-useref'),
gulpif = require('gulp-if'),
react = require('gulp-react');
var config = {
srcPath: './src',
imgPath: './src/img',
nodeDir: './node_modules',
destDir: './dist'
}
gulp.task('clean', function () {
return gulp.src(config.destDir, { read: false })
.pipe(clean())
});
gulp.task('compile', function () {
return gulp.src(config.srcPath + '/*.html')
.pipe(useref())
.pipe(gulpif('*.js', react()))
.pipe(gulpif('*.js', uglify()))
.pipe(gulpif('*.css',
sass({
outputStyle: 'compressed',
includePaths: [
config.nodeDir + '/bootstrap-sass/assets/stylesheets',
config.nodeDir + '/font-awesome/scss'
]
})/*,
htmlmin({collapseWhitespace: true}) */
))
.pipe(gulp.dest(config.destDir))
});
gulp.task('images', function() {
return gulp.src(config.imgPath + '/**/*')
.pipe(cache(imgmin({ optimizationLevel: 5, progressive: true, interlaced: true, multipass: true })))
.pipe(gulp.dest(config.destDir + '/img'))
});
gulp.task('copy-txt-files', function() {
return gulp.src(config.srcPath + '/*.txt')
.pipe(gulp.dest(config.destDir))
});
gulp.task('copy-bs-fonts', function(){
return gulp.src(config.nodeDir + '/bootstrap-sass/assets/fonts/bootstrap/*.{eot,svg,ttf,woff,woff2}')
.pipe(gulp.dest(config.destDir + '/fonts/bootstrap'));
});
gulp.task('default', ['clean'], function() {
gulp.start('compile', 'images', 'copy-txt-files', 'copy-bs-fonts')
});