forked from merlinnot/A11YPortal
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathgulpfile.js
107 lines (86 loc) · 2.49 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
const axe = require('gulp-axe-webdriver');
const browserSync = require('browser-sync');
const del = require('del');
const eslint = require('gulp-eslint');
const gulp = require('gulp');
const sass = require('gulp-sass');
const browserSyncInstance = browserSync.create();
gulp.task('axe', function() {
var options = {
saveOutputIn: 'allHtml.json',
headless: true,
urls: ['dist/guidelines/design/visual-design.html', 'dist/index.html']
};
return axe(options);
});
gulp.task('clean', () => del(['dist/**', '!dist'], { force: true }));
gulp.task('scss', () =>
gulp
.src('src/styles/**/*.scss', { base: 'src' })
.pipe(sass().on('error', sass.logError))
.pipe(gulp.dest('dist'))
);
gulp.task('css', () =>
gulp
.src('src/styles/**/*.css', { base: 'src', since: gulp.lastRun('css') })
.pipe(gulp.dest('dist'))
);
gulp.task('html', () =>
gulp
.src('src/**/*.html', { base: 'src', since: gulp.lastRun('html') })
.pipe(gulp.dest('dist'))
);
gulp.task('js', () =>
gulp
.src('src/**/*.js', { base: 'src', since: gulp.lastRun('js') })
.pipe(eslint())
.pipe(eslint.format())
.pipe(gulp.dest('dist'))
);
gulp.task('images', () =>
gulp
.src('src/images/**/*', { base: 'src', since: gulp.lastRun('images') })
.pipe(gulp.dest('dist'))
);
gulp.task('fonts', () =>
gulp
.src('src/fonts/**/*', { base: 'src', since: gulp.lastRun('fonts') })
.pipe(gulp.dest('dist'))
);
gulp.task('pdf', () =>
gulp
.src('src/**/*.pdf', { base: 'src', since: gulp.lastRun('pdf') })
.pipe(gulp.dest('dist'))
);
gulp.task('psd', () =>
gulp
.src('src/**/*.psd', { base: 'src', since: gulp.lastRun('psd') })
.pipe(gulp.dest('dist'))
);
gulp.task('zip', () =>
gulp
.src('src/**/*.zip', { base: 'src', since: gulp.lastRun('zip') })
.pipe(gulp.dest('dist'))
);
gulp.task('htaccess', () =>
gulp
.src('src/**/.htaccess', { base: 'src', since: gulp.lastRun('htaccess') })
.pipe(gulp.dest('dist'))
);
gulp.task('build', gulp.parallel('html', 'images', 'js', 'css', 'scss', 'fonts', 'pdf', 'psd', 'zip', 'htaccess'));
gulp.task('valid', function () {
gulp.src('src/**/*.html')
.pipe(htmlv())
.pipe(gulp.dest('./out'));
});
gulp.task('watch', () => {
browserSyncInstance.init({
port: 8080,
server: 'dist'
});
gulp
.watch(['src/**/*'], gulp.series('build'))
.on('change', browserSyncInstance.reload);
});
gulp.task('start:dev', gulp.series('clean', 'build', 'watch'));
gulp.task('test', gulp.series('clean', 'build', 'axe'));