forked from indiana-university/rivet-icons
-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
49 lines (41 loc) · 1.07 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
/*!
* Copyright (C) 2019 The Trustees of Indiana University
* SPDX-License-Identifier: BSD-3-Clause
*/
const { src, dest, series } = require('gulp');
const svgSprite = require('gulp-svg-sprite');
const rename = require('gulp-rename');
const del = require('del');
const config = require('./svg.config');
function buildSymbol() {
return src(config.svgFilePaths)
.pipe(svgSprite({
mode: {
symbol: true
}
}))
.pipe(dest('dist/'));
}
function renameSymbol() {
return src('./dist/symbol/svg/sprite.symbol.svg')
.pipe(rename(`${config.symbolFileName}.svg`))
.pipe(dest('./dist'));
}
/**
* Cleans up folders from svgSprite and moves a copy of rvt-icons.svg into
* the docs folder to use with icon preview page.
*/
function buildFileStructure(callback) {
del('./dist/symbol/');
src(`./dist/${config.symbolFileName}.svg`)
.pipe(dest('./docs/svg/'));
src('./src/svg/**.svg')
.pipe(dest('./dist/svgs/'));
callback();
}
// Builds SVG sprite sheet
exports.build = series(
buildSymbol,
renameSymbol,
buildFileStructure
);