-
Notifications
You must be signed in to change notification settings - Fork 14
/
gulpfile.js
87 lines (75 loc) · 2.4 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
const gulp = require('gulp'),
shell = require('gulp-shell'),
uglify = require('gulp-uglify'),
concat = require('gulp-concat'),
pump = require('pump'),
stylus = require('gulp-stylus'),
sourcemaps = require('gulp-sourcemaps'),
sprite = require('gulp-svgstore'),
{asyncHtmlInline} = require('async-html-inline');;
const project = {
buildDest: './dist',
buildSrc: './src'
};
// Uglify our javascript files into one.
// Use pump to expose errors more usefully.
gulp.task('scripts', function(done) {
pump([
gulp.src(project.buildSrc + '/js/**/*.js'),
concat('bundle.js'),
uglify(),
gulp.dest(project.buildDest + '/')
],
done()
);
});
gulp.task('styles', function() {
return gulp.src(project.buildSrc + '/styles/index.styl')
//.pipe(sourcemaps.init())
.pipe(stylus({
compress: true
}))
.pipe(concat('bundle.css'))
//.pipe(sourcemaps.write())
.pipe(gulp.dest(project.buildDest + '/'));
});
gulp.task('widgetStyles', function() {
return gulp.src(project.buildSrc + '/patronsWidget.styl')
//.pipe(sourcemaps.init())
.pipe(stylus({
compress: true
}))
.pipe(concat('patronsWidget.css'))
//.pipe(sourcemaps.write())
.pipe(gulp.dest(project.buildDest + '/'));
});
gulp.task('watch', function () {
gulp.watch(project.buildSrc + '/js/**/*', gulp.parallel('scripts'));
gulp.watch(project.buildSrc + '/styles/**/*', gulp.parallel('styles'));
gulp.watch(project.buildSrc + '/patronsWidget.styl', gulp.parallel('widgetStyles'));
gulp.watch(project.buildSrc + '/icons/**/*.svg', gulp.parallel('icons'));
});
gulp.task('icons', () =>
gulp.src(project.buildSrc + '/icons/**/*.svg')
.pipe(sprite())
.pipe(gulp.dest(project.buildDest + '/'))
);
gulp.task('assets', gulp.parallel(
'styles',
'widgetStyles',
'scripts',
'icons'
));
gulp.task('inlineImages', async () => {
await asyncHtmlInline(project.buildDest + '/patronsWidget.svg', project.buildDest + '/patronsWidgetInlined.svg');
});
gulp.task('generate', shell.task('eleventy'));
gulp.task('build', gulp.series(
'assets',
'generate',
'inlineImages'
));
gulp.task('serve', shell.task('eleventy --serve'));
gulp.task('serveDebug', shell.task('DEBUG=* && eleventy --serve'));
gulp.task('default', gulp.parallel('serve', 'assets', 'watch'));
gulp.task('debug', gulp.parallel('serveDebug', 'assets', 'watch'));