-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
115 lines (104 loc) · 2.3 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
113
114
115
'use strict';
// ----------------------------------------
// Imports
// ----------------------------------------
const gulp = require('gulp');
const uglify = require('gulp-uglify');
const sourcemaps = require('gulp-sourcemaps');
const jsdoc = require('gulp-jsdoc3');
const del = require('del');
const gulpModernizrWezom = require('./index');
// ----------------------------------------
// Private
// ----------------------------------------
const docsSrc = ['./index.js', './utils/**/*.js'];
const docsDest = './api-docs';
const jsdocConfig = {
source: {
includePattern: '.+\\.js(docs|x)?$',
excludePattern: '(^|\\/|\\\\)_'
},
tags: {
allowUnknownTags: true,
dictionaries: [
'jsdoc',
'closure'
]
},
opts: {
encoding: 'utf8',
template: './node_modules/jsdoc-simple-theme/',
destination: docsDest,
recurse: true,
debug: false,
verbose: false
},
plugins: [
'plugins/markdown',
'./node_modules/jsdoc-export-default-interop/dist/index',
'./node_modules/jsdoc-ignore-code/index',
'./node_modules/jsdoc-sourcecode-tag/index'
],
markdown: {
parser: 'gfm',
hardwrap: true
},
templates: {
cleverLinks: false,
monospaceLinks: false,
systemName: 'system API docs',
default: {
outputSourceFiles: true,
layoutFile: './node_modules/jsdoc-simple-theme/tmpl/layout.tmpl'
}
}
};
// ----------------------------------------
// Public
// ----------------------------------------
gulp.task('docs', function (done) {
del.sync(docsDest);
gulp.src(docsSrc, {buffer: false})
.pipe(jsdoc(jsdocConfig, function (err) {
if (err) {
console.log(err.message);
return this.emit('end');
}
console.log('done');
done();
}));
});
gulp.task('docs-watch', gulp.series('docs', function () {
gulp.watch(docsSrc, gulp.series('docs'));
}));
gulp.task('modernizr', function () {
let src = [
'./detects/**/*.css',
'./detects/**/*.js',
'!./detects/**/modernizr.js'
];
return gulp.src(src)
.pipe(gulpModernizrWezom({
tests: [
'touchevents'
],
customTests: './my-feature-detects/custom-tests',
excludeTests: [
'svg',
'opacity',
'checked'
],
options: [
'setClasses',
'mq'
]
}))
.pipe(sourcemaps.init())
.pipe(uglify({
mangle: {
reserved: ['Modernizr']
}
}))
.pipe(sourcemaps.write('/'))
.pipe(gulp.dest('./detects/'));
});