vsc-material-theme/.gulp/tasks/icons.js

32 lines
768 B
JavaScript
Raw Normal View History

2017-02-04 12:31:33 +01:00
'use strict';
/*
* > Build Icons
*/
import Gulp from 'gulp';
import Colorize from 'gulp-colorize-svgs';
2017-02-04 13:01:19 +01:00
import colors from 'colors';
2017-02-04 12:31:33 +01:00
import Paths from '../paths';
2017-02-04 13:01:19 +01:00
import del from 'del';
import iconsColors from '../../icons/colors.js';
2017-02-04 12:31:33 +01:00
2017-02-04 14:27:04 +01:00
console.log(iconsColors);
2017-02-04 12:31:33 +01:00
Gulp.task('process:icons', () => {
2017-02-04 13:01:19 +01:00
del([`${Paths.icons}/svg/*.svg`]).then(paths => {
2017-02-04 14:27:04 +01:00
console.log('[ 🔥 Deleting all icons]\n'.bold.red);
2017-02-04 13:01:19 +01:00
});
2017-02-04 12:31:33 +01:00
Gulp.src(`${Paths.src}/icons/*.svg`)
2017-02-04 14:27:04 +01:00
.pipe(Colorize({
colors: iconsColors,
replaceColor: function (content, hex) {
return content.replace('#000', '#' + hex);
},
replacePath: function (path, colorKey) {
return path.replace(/\.svg/, '.svg');
}
}))
2017-02-04 13:01:19 +01:00
.pipe(Gulp.dest(`${Paths.icons}/svg`));
2017-02-04 12:31:33 +01:00
});