forked from WalletScrutiny/WalletScrutinyCom
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgulpfile.js
64 lines (56 loc) · 1.6 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
64
var gulp = require('gulp')
var shell = require('gulp-shell')
var sass = require('gulp-sass')(require('node-sass'))
var minify = require('gulp-minify')
var rename = require('gulp-rename')
sass.compiler = require('node-sass')
var del = require('del')
const htmlmin = require('gulp-htmlmin')
gulp.task('minify', () => {
return gulp
.src('_site/index.html')
.pipe(
htmlmin({
collapseWhitespace: true,
removeComments: true
})
)
.pipe(gulp.dest('_site'))
})
gulp.task('minjs', () => {
return gulp.src('_site/**/*.js')
.pipe(minify({
ext: {
min: '.jsm'
},
ignoreFiles: ['.min.js', '-min.js']
}))
.pipe(gulp.dest('_site/'))
})
gulp.task('cleanjs', () => {
return del('_site/**/*.js')
})
gulp.task('rename', () => {
return gulp
.src('./_site/**/*.jsm')
.pipe(rename({ extname: '.js' }))
.pipe(gulp.dest('./_site/'))
})
gulp.task('cleanjsm', () => {
return del('_site/**/*.jsm')
})
gulp.task('move', () => {
return gulp
.src('./_site/_minjs/')
.pipe(gulp.dest('./_site/'))
})
gulp.task('sass', () => {
return gulp
.src('./_site/assets/css/*.css')
.pipe(sass({ outputStyle: 'compressed' }).on('error', sass.logError))
.pipe(gulp.dest('./_site/assets/css/'))
})
// Task for building blog when something changed:
gulp.task('jekyll', shell.task('bundle exec jekyll build'))
gulp.task('serve', shell.task('bundle exec jekyll serve --profile --trace --safe --host=0.0.0.0 --config _config.yml,_config.dev.yml'))
gulp.task('default', gulp.series('jekyll', 'sass', 'minify', 'minjs', 'cleanjs', 'rename', 'cleanjsm'))