-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
112 lines (99 loc) · 3.19 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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
(function() {
'use strict';
// Include Gulp & Tools
var gulp = require('gulp'),
sass = require('gulp-sass'),
minifycss = require('gulp-minify-css'),
autoprefixer = require('gulp-autoprefixer'),
concat = require('gulp-concat'),
rename = require('gulp-rename'),
jshint = require('gulp-jshint'),
uglify = require('gulp-uglify'),
plumber = require('gulp-plumber'),
gutil = require('gulp-util'),
replace = require('gulp-replace'),
zip = require('gulp-zip'),
fs = require('fs');
// Set the compiler to use Dart Sass instead of Node Sass
sass.compiler = require('dart-sass');
var onError = function( err ) {
console.log('An error occurred:', gutil.colors.magenta(err.message));
gutil.beep();
this.emit('end');
};
// SASS
gulp.task('sass', function (done) {
return gulp.src('./assets/sass/*.scss')
.pipe(plumber({ errorHandler: onError }))
.pipe(sass())
.pipe(autoprefixer())
.pipe(rename({suffix: '.min'}))
.pipe(minifycss())
.pipe(gulp.dest('./assets/css'))
done();
});
gulp.task('inlinecss', function(done) {
return gulp.src(['partials/inline-css.hbs'])
.pipe(replace('@@compiled_css', fs.readFileSync('assets/css/style.min.css')))
.pipe(gulp.dest('partials/compiled'))
done();
});
// JavaScript
gulp.task('js', function(done) {
return gulp.src([
'./bower_components/jquery/dist/jquery.js',
'./node_modules/evil-icons/assets/evil-icons.min.js',
'./bower_components/fitvids/jquery.fitvids.js',
'./node_modules/prismjs/prism.js',
'./node_modules/lunr/lunr.js',
'./node_modules/lunr-languages/lunr.stemmer.support.js',
'./node_modules/lunr-languages/lunr.ru.js',
'./node_modules/lunr-languages/lunr.fr.js',
'./node_modules/lunr-languages/lunr.de.js',
'./node_modules/lunr-languages/lunr.es.js',
'./node_modules/lunr-languages/lunr.pt.js',
'./node_modules/lunr-languages/lunr.it.js',
'./node_modules/lunr-languages/lunr.fi.js',
'./node_modules/lunr-languages/lunr.nl.js',
'./node_modules/lunr-languages/lunr.da.js',
'./node_modules/lunr-languages/lunr.multi.js',
'./assets/js/ghosthunter.js',
'./assets/js/app.js'])
.pipe(jshint())
.pipe(jshint.reporter('jshint-stylish'))
.pipe(concat('app.js'))
.pipe(rename({suffix: '.min'}))
.pipe(uglify())
.pipe(gulp.dest('./assets/js'))
done();
});
gulp.task('watch', function() {
gulp.watch('assets/sass/**/*.scss', gulp.series('build_css'));
gulp.watch(['./assets/js/app.js', './assets/js/ghosthunter.js'], gulp.series('js'));
});
gulp.task(
'build_css',
gulp.series('sass', 'inlinecss')
);
gulp.task(
'build',
gulp.series('build_css', 'js')
);
gulp.task('zip', function () {
return gulp.src([
'./**',
'!node_modules/**',
'!bower_components/**',
'!.git/**',
'!.DS_Store',
'!package-lock.json'
], { dot: true })
.pipe(zip('east.zip'))
.pipe(gulp.dest('../'))
done();
});
gulp.task(
'default',
gulp.series('build', 'watch')
);
})();