-
Notifications
You must be signed in to change notification settings - Fork 1
/
gulpfile.js
61 lines (49 loc) · 1.52 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
const seq = require('gulp4-run-sequence');
const json = require('./util/icons2json');
const config = require('./util/config.js');
// const browserify = require('browserify');
// const source = require('vinyl-source-stream')
var browserify = require('gulp-browserify');
const gulp = require('gulp');
const svgmin = require('gulp-svgmin');
const rename = require('gulp-rename');
const header = require('gulp-header');
const uglify = require('gulp-uglify-es').default;
const pkg = require('./package.json');
const head = `/*!
* ${pkg.name} - ${pkg.version} - (https://lucasgruwez.github.io/${pkg.name})
* Copyright ${new Date().getFullYear()} Lucas Gruwez.
* Licensed under ${pkg.license}
* https://github.com/lucasgruwez/${pkg.name}
*/
`
gulp.task('default', () => {
seq('json', 'browserify', 'minify', 'docs')
})
gulp.task('docs', () => {
config()
return gulp.src('*')
})
gulp.task('browserify', () => {
return gulp.src(['./src/index.js'])
.pipe(browserify())
.pipe(header(head))
.pipe(rename('lunar-icons.js'))
.pipe(gulp.dest('./dist'))
})
gulp.task('minify', () => {
return gulp.src(['./dist/lunar-icons.js'])
.pipe(uglify())
.pipe(header(head))
.pipe(rename({suffix: '.min'}))
.pipe(gulp.dest('./dist'))
})
gulp.task('json', () => {
return gulp.src('./src/icons/*.svg')
.pipe(svgmin({
plugins: [
{cleanupIDs: false}
]
}))
.pipe(json())
});