aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gulpfile.js59
-rw-r--r--src/_icons/arrow-big-down.svg2
-rw-r--r--src/_icons/arrow-big-left.svg2
-rw-r--r--src/_icons/arrow-big-right.svg2
-rw-r--r--src/_icons/arrow-big-top.svg2
-rw-r--r--src/_icons/arrows-double-ne-sw.svg8
-rw-r--r--src/_icons/arrows-double-nw-se.svg8
-rw-r--r--src/_icons/arrows-double-se-nw.svg8
-rw-r--r--src/_icons/arrows-double-sw-ne.svg8
-rw-r--r--src/_icons/bell-minus.svg6
-rw-r--r--src/_icons/bell-plus.svg8
-rw-r--r--src/_icons/bell-x.svg6
-rw-r--r--src/_icons/file-alert.svg4
-rw-r--r--src/_icons/file-analytics.svg6
-rw-r--r--src/_icons/zoom-question.svg8
15 files changed, 91 insertions, 46 deletions
diff --git a/gulpfile.js b/gulpfile.js
index da9f4aa0..d461eecd 100644
--- a/gulpfile.js
+++ b/gulpfile.js
@@ -4,6 +4,7 @@ const gulp = require('gulp'),
fs = require('fs'),
path = require('path'),
p = require('./package.json'),
+ csv = require('csv-parser'),
zip = require('gulp-zip'),
puppeteer = require('puppeteer'),
outlineStroke = require('svg-outline-stroke'),
@@ -12,6 +13,8 @@ const gulp = require('gulp'),
sass = require('node-sass'),
cleanCSS = require('clean-css'),
argv = require('minimist')(process.argv.slice(2)),
+ svgParse = require('parse-svg-path'),
+ svgpath = require('svgpath'),
svgr = require('@svgr/core').default;
async function asyncForEach(array, callback) {
@@ -404,6 +407,17 @@ gulp.task('optimize', function (cb) {
return Math.round((parseFloat(n1) + parseFloat(n2)) * 1000) / 1000
};
+ const optimizePath = function(path) {
+ let transformed = svgpath(path)
+ .rel()
+ .round(3)
+ .toString();
+
+ return svgParse(transformed).map(function(a){
+ return a.join(' ');
+ }).join(' ');
+ };
+
glob("src/_icons/*.svg", {}, function (er, files) {
files.forEach(function (file, i) {
@@ -416,6 +430,11 @@ gulp.task('optimize', function (cb) {
.replace(/\s?\/>/g, ' />')
.replace(/\n\s*<(line|circle|path|polyline|rect)/g, "\n <$1")
.replace(/polyline points="([0-9.]+)\s([0-9.]+)\s([0-9.]+)\s([0-9.]+)"/g, 'line x1="$1" y1="$2" x2="$3" y2="$4"')
+ .replace(/<path d="([^"]+)"/g, function(f, r1) {
+ r1 = optimizePath(r1);
+
+ return `<path d="${r1}"`;
+ })
.replace(/d="m/g, 'd="M')
.replace(/([Aa])\s?([0-9.]+)\s([0-9.]+)\s([0-9.]+)\s?([0-1])\s?([0-1])\s?(-?[0-9.]+)\s?(-?[0-9.]+)/gi, '$1$2 $3 $4 $5 $6 $7 $8')
.replace(/\n\n+/g, "\n")
@@ -439,9 +458,6 @@ gulp.task('optimize', function (cb) {
})
;
- //
- //
-
if (svgFile.toString() !== svgFileContent) {
fs.writeFileSync(file, svgFileContent);
}
@@ -610,17 +626,17 @@ const setVersions = function(version, files) {
if (fs.existsSync(`src/_icons/${file}.svg`)) {
let svgFile = fs.readFileSync(`src/_icons/${file}.svg`).toString();
-
+
if(!svgFile.match(/version: ([0-9.]+)/i)) {
svgFile = svgFile.replace(/---\n<svg>/i, function(m){
return `version: ${version}\n${m}`;
});
-
+
fs.writeFileSync(`src/_icons/${file}.svg`, svgFile);
} else {
console.log(`File ${file} already has version`);
}
-
+
} else {
console.log(`File ${file} doesn't exists`);
}
@@ -636,7 +652,7 @@ gulp.task('update-icons-version', function (cb) {
cp.exec(`git diff v${version} HEAD --name-status`, function (err, ret) {
let newIcons = [];
-
+
ret.replace(/[A]\s+src\/_icons\/([a-z0-9-]+)\.svg/g, function (m, fileName) {
newIcons.push(fileName);
});
@@ -650,6 +666,35 @@ gulp.task('update-icons-version', function (cb) {
cb();
});
+gulp.task('import-tags', function(cb) {
+ fs.createReadStream('./_import.csv')
+ .pipe(csv({
+ headers: false,
+ separator: "\t"
+ }))
+ .on('data', (row) => {
+ console.log(row[0], row[1]);
+
+ const filename = `src/_icons/${row[0]}.svg`;
+
+ let data = fs.readFileSync(filename).toString();
+ data = data.replace(/(---[\s\S]+?---)/, function(m, headerContent){
+
+ headerContent = headerContent.replace(/tags: .*\n/, '');
+ headerContent = headerContent.replace(/---/, `---\ntags: [${row[1]}]`);
+
+ return headerContent;
+ });
+
+ fs.writeFileSync(filename, data);
+
+ })
+ .on('end', () => {
+ console.log('CSV file successfully processed');
+ });
+ cb();
+});
+
gulp.task("build-react", function (cb) {
cp.exec("npm run build-react", function () {
cb();
diff --git a/src/_icons/arrow-big-down.svg b/src/_icons/arrow-big-down.svg
index 90ff7ae2..426b5205 100644
--- a/src/_icons/arrow-big-down.svg
+++ b/src/_icons/arrow-big-down.svg
@@ -2,5 +2,5 @@
category: Arrows
---
<svg>
- <path d="M15 4v8h3.586a1 1 0 0 1 .707 1.707l-6.586 6.586a1 1 0 0 1-1.414 0l-6.586-6.586A1 1 0 0 1 5.414 12H9V4a1 1 0 0 1 1-1h4a1 1 0 0 1 1 1z"/>
+ <path d="M15 4v8h3.586a1 1 0 0 1 .707 1.707l-6.586 6.586a1 1 0 0 1 -1.414 0l-6.586 -6.586a1 1 0 0 1 .707 -1.707h3.586v-8a1 1 0 0 1 1 -1h4a1 1 0 0 1 1 1z" />
</svg>
diff --git a/src/_icons/arrow-big-left.svg b/src/_icons/arrow-big-left.svg
index b2f8e3a1..abc3d7f6 100644
--- a/src/_icons/arrow-big-left.svg
+++ b/src/_icons/arrow-big-left.svg
@@ -2,5 +2,5 @@
category: Arrows
---
<svg>
- <path d="M20 15h-8v3.586a1 1 0 0 1-1.707.707l-6.586-6.586a1 1 0 0 1 0-1.414l6.586-6.586A1 1 0 0 1 12 5.414V9h8a1 1 0 0 1 1 1v4a1 1 0 0 1-1 1z"/>
+ <path d="M20 15h-8v3.586a1 1 0 0 1 -1.707 .707l-6.586 -6.586a1 1 0 0 1 0 -1.414l6.586 -6.586a1 1 0 0 1 1.707 .707v3.586h8a1 1 0 0 1 1 1v4a1 1 0 0 1 -1 1z" />
</svg>
diff --git a/src/_icons/arrow-big-right.svg b/src/_icons/arrow-big-right.svg
index 572a6a23..1963b71e 100644
--- a/src/_icons/arrow-big-right.svg
+++ b/src/_icons/arrow-big-right.svg
@@ -2,5 +2,5 @@
category: Arrows
---
<svg>
- <path d="M4 9h8V5.414a1 1 0 0 1 1.707-.707l6.586 6.586a1 1 0 0 1 0 1.414l-6.586 6.586A1 1 0 0 1 12 18.586V15H4a1 1 0 0 1-1-1v-4a1 1 0 0 1 1-1z"/>
+ <path d="M4 9h8v-3.586a1 1 0 0 1 1.707 -.707l6.586 6.586a1 1 0 0 1 0 1.414l-6.586 6.586a1 1 0 0 1 -1.707 -.707v-3.586h-8a1 1 0 0 1 -1 -1v-4a1 1 0 0 1 1 -1z" />
</svg>
diff --git a/src/_icons/arrow-big-top.svg b/src/_icons/arrow-big-top.svg
index 15dce382..ec12b0b7 100644
--- a/src/_icons/arrow-big-top.svg
+++ b/src/_icons/arrow-big-top.svg
@@ -2,5 +2,5 @@
category: Arrows
---
<svg>
- <path d="M9 20v-8H5.414a1 1 0 0 1-.707-1.707l6.586-6.586a1 1 0 0 1 1.414 0l6.586 6.586A1 1 0 0 1 18.586 12H15v8a1 1 0 0 1-1 1h-4a1 1 0 0 1-1-1z"/>
+ <path d="M9 20v-8h-3.586a1 1 0 0 1 -.707 -1.707l6.586 -6.586a1 1 0 0 1 1.414 0l6.586 6.586a1 1 0 0 1 -.707 1.707h-3.586v8a1 1 0 0 1 -1 1h-4a1 1 0 0 1 -1 -1z" />
</svg>
diff --git a/src/_icons/arrows-double-ne-sw.svg b/src/_icons/arrows-double-ne-sw.svg
index 6e35356a..f6734e60 100644
--- a/src/_icons/arrows-double-ne-sw.svg
+++ b/src/_icons/arrows-double-ne-sw.svg
@@ -2,8 +2,8 @@
category: Arrows
---
<svg>
- <path d="M3 14L14 3"/>
- <path d="M10 3h4v4"/>
- <path d="M10 17v4h4"/>
- <path d="M21 10L10 21"/>
+ <path d="M3 14L14 3" />
+ <path d="M10 3h4v4" />
+ <path d="M10 17v4h4" />
+ <path d="M21 10L10 21" />
</svg>
diff --git a/src/_icons/arrows-double-nw-se.svg b/src/_icons/arrows-double-nw-se.svg
index 0780c584..a3dea4e8 100644
--- a/src/_icons/arrows-double-nw-se.svg
+++ b/src/_icons/arrows-double-nw-se.svg
@@ -2,8 +2,8 @@
category: Arrows
---
<svg>
- <path d="M14 21L3 10"/>
- <path d="M3 14v-4h4"/>
- <path d="M17 14h4v-4"/>
- <path d="M10 3l11 11"/>
+ <path d="M14 21L3 10" />
+ <path d="M3 14v-4h4" />
+ <path d="M17 14h4v-4" />
+ <line x1="10" y1="3" x2="21" y2="14" />
</svg>
diff --git a/src/_icons/arrows-double-se-nw.svg b/src/_icons/arrows-double-se-nw.svg
index 56cb2ba6..bde9f502 100644
--- a/src/_icons/arrows-double-se-nw.svg
+++ b/src/_icons/arrows-double-se-nw.svg
@@ -2,8 +2,8 @@
category: Arrows
---
<svg>
- <path d="M3 10l11 11"/>
- <path d="M14 17v4h-4"/>
- <path d="M14 3h-4v4"/>
- <path d="M21 14L10 3"/>
+ <line x1="3" y1="10" x2="14" y2="21" />
+ <path d="M14 17v4h-4" />
+ <path d="M14 3h-4v4" />
+ <path d="M21 14L10 3" />
</svg>
diff --git a/src/_icons/arrows-double-sw-ne.svg b/src/_icons/arrows-double-sw-ne.svg
index 366a568a..85ea04ee 100644
--- a/src/_icons/arrows-double-sw-ne.svg
+++ b/src/_icons/arrows-double-sw-ne.svg
@@ -2,8 +2,8 @@
category: Arrows
---
<svg>
- <path d="M14 3L3 14"/>
- <path d="M3 10v4h4"/>
- <path d="M17 10h4v4"/>
- <path d="M10 21l11-11"/>
+ <path d="M14 3L3 14" />
+ <path d="M3 10v4h4" />
+ <path d="M17 10h4v4" />
+ <path d="M10 21l11-11" />
</svg>
diff --git a/src/_icons/bell-minus.svg b/src/_icons/bell-minus.svg
index 9e296ebb..6e858cc5 100644
--- a/src/_icons/bell-minus.svg
+++ b/src/_icons/bell-minus.svg
@@ -2,7 +2,7 @@
category: System
---
<svg>
- <path d="M10 5a2 2 0 1 1 4 0 7 7 0 0 1 4 6v3a4 4 0 0 0 2 3H4a4 4 0 0 0 2-3v-3a7 7 0 0 1 4-6"/>
- <path d="M9 17v1a3 3 0 0 0 6 0v-1"/>
- <path d="M10 11h4"/>
+ <path d="M10 5a2 2 0 1 1 4 0 7 7 0 0 1 4 6v3a4 4 0 0 0 2 3H4a4 4 0 0 0 2 -3v-3a7 7 0 0 1 4 -6" />
+ <path d="M9 17v1a3 3 0 0 0 6 0v-1" />
+ <line x1="10" y1="11" x2="14" y2="11" />
</svg>
diff --git a/src/_icons/bell-plus.svg b/src/_icons/bell-plus.svg
index 87bd9cd8..ff558eec 100644
--- a/src/_icons/bell-plus.svg
+++ b/src/_icons/bell-plus.svg
@@ -2,8 +2,8 @@
category: System
---
<svg>
- <path d="M10 5a2 2 0 1 1 4 0 7 7 0 0 1 4 6v3a4 4 0 0 0 2 3H4a4 4 0 0 0 2-3v-3a7 7 0 0 1 4-6"/>
- <path d="M9 17v1a3 3 0 0 0 6 0v-1"/>
- <path d="M10 11h4"/>
- <path d="M12 9v4"/>
+ <path d="M10 5a2 2 0 1 1 4 0 7 7 0 0 1 4 6v3a4 4 0 0 0 2 3H4a4 4 0 0 0 2 -3v-3a7 7 0 0 1 4 -6" />
+ <path d="M9 17v1a3 3 0 0 0 6 0v-1" />
+ <line x1="10" y1="11" x2="14" y2="11" />
+ <line x1="12" y1="9" x2="12" y2="13" />
</svg>
diff --git a/src/_icons/bell-x.svg b/src/_icons/bell-x.svg
index 0f6254c0..8167ee4c 100644
--- a/src/_icons/bell-x.svg
+++ b/src/_icons/bell-x.svg
@@ -2,7 +2,7 @@
category: System
---
<svg>
- <path d="M10 5a2 2 0 1 1 4 0 7 7 0 0 1 4 6v3a4 4 0 0 0 2 3H4a4 4 0 0 0 2-3v-3a7 7 0 0 1 4-6"/>
- <path d="M9 17v1a3 3 0 0 0 6 0v-1"/>
- <path d="M10.5 9.5l3 3m0-3l-3 3"/>
+ <path d="M10 5a2 2 0 1 1 4 0 7 7 0 0 1 4 6v3a4 4 0 0 0 2 3H4a4 4 0 0 0 2 -3v-3a7 7 0 0 1 4 -6" />
+ <path d="M9 17v1a3 3 0 0 0 6 0v-1" />
+ <path d="M10.5 9.5l3 3m0-3l-3 3" />
</svg>
diff --git a/src/_icons/file-alert.svg b/src/_icons/file-alert.svg
index 459b4bd9..786c46e8 100644
--- a/src/_icons/file-alert.svg
+++ b/src/_icons/file-alert.svg
@@ -5,6 +5,6 @@ category: Document
<svg>
<path d="M14 3v4a1 1 0 0 0 1 1h4" />
<path d="M17 21h-10a2 2 0 0 1 -2 -2v-14a2 2 0 0 1 2 -2h7l5 5v11a2 2 0 0 1 -2 2z" />
- <path d="M12 17h.01" />
- <path d="M12 11v3" />
+ <line x1="12" y1="17" x2="12.01" y2="17" />
+ <line x1="12" y1="11" x2="12" y2="14" />
</svg>
diff --git a/src/_icons/file-analytics.svg b/src/_icons/file-analytics.svg
index d5397dde..bfacad28 100644
--- a/src/_icons/file-analytics.svg
+++ b/src/_icons/file-analytics.svg
@@ -5,7 +5,7 @@ category: Document
<svg>
<path d="M14 3v4a1 1 0 0 0 1 1h4" />
<path d="M17 21h-10a2 2 0 0 1 -2 -2v-14a2 2 0 0 1 2 -2h7l5 5v11a2 2 0 0 1 -2 2z" />
- <path d="M9 17v-5" />
- <path d="M12 17v-1" />
- <path d="M15 17v-3" />
+ <line x1="9" y1="17" x2="9" y2="12" />
+ <line x1="12" y1="17" x2="12" y2="16" />
+ <line x1="15" y1="17" x2="15" y2="14" />
</svg>
diff --git a/src/_icons/zoom-question.svg b/src/_icons/zoom-question.svg
index b3689fa4..85c5a881 100644
--- a/src/_icons/zoom-question.svg
+++ b/src/_icons/zoom-question.svg
@@ -2,8 +2,8 @@
category: Map
---
<svg>
- <circle cx="10" cy="10" r="7"/>
- <path d="M21 21l-6-6"/>
- <path d="M10 13v.01"/>
- <path d="M10 10a1.5 1.5 0 1 0-1.14-2.474"/>
+ <circle cx="10" cy="10" r="7" />
+ <path d="M21 21l-6-6" />
+ <line x1="10" y1="13" x2="10" y2="13.01" />
+ <path d="M10 10a1.5 1.5 0 1 0 -1.14 -2.474" />
</svg>