Skip to content

Commit 3c045ed

Browse files
authored
fix: include missing icons to Lumo icon sets (#1989)
1 parent f90382d commit 3c045ed

File tree

4 files changed

+62
-45
lines changed

4 files changed

+62
-45
lines changed

packages/vaadin-lumo-styles/gulpfile.js

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -41,14 +41,17 @@ function createIconset(folder, filenames, idPrefix = '') {
4141
}
4242

4343
const content = fs.readFileSync(folder + filename, 'utf-8');
44-
const path = content.match(/<path d="([^"]*)"/);
44+
const path = content.match(/<path( fill-rule="evenodd" clip-rule="evenodd")* d="([^"]*)"/);
4545
if (path) {
46-
const newPath = new svgpath(path[1])
46+
const newPath = new svgpath(path[2])
4747
.scale(1000 / 24, 1000 / 24)
4848
.round(0)
4949
.toString();
5050
const name = filename.replace('.svg', '').replace(/\s/g, '-').toLowerCase();
51-
output += `<g id="${idPrefix}${name}"><path d="${newPath}"></path></g>\n`;
51+
const attrs = path[1] !== undefined ? path[1] : '';
52+
output += `<g id="${idPrefix}${name}"><path d="${newPath}"${attrs}></path></g>\n`;
53+
} else {
54+
throw new Error(`Unexpected SVG content: ${filename}`);
5255
}
5356
});
5457

@@ -118,8 +121,8 @@ import './version.js';
118121
119122
const $_documentContainer = document.createElement('template');
120123
121-
$_documentContainer.innerHTML = \`<vaadin-iconset name="lumo">
122-
${createIconset(folder, filenames, 'vaadin-icon:')}
124+
$_documentContainer.innerHTML = \`<vaadin-iconset name="lumo" size="1000">
125+
${createIconset(folder, filenames, 'lumo:')}
123126
</vaadin-iconset>\`;\n\ndocument.head.appendChild($_documentContainer.content);\n`;
124127

125128
fs.writeFile('vaadin-iconset.js', vaadinIcons, function (err) {
@@ -195,6 +198,13 @@ document.head.appendChild($_documentContainer.content);
195198
}
196199
});
197200

201+
const list = glyphs.map((g) => g.name);
202+
fs.writeFile('test/glyphs.json', JSON.stringify(list, null, 2), function (err) {
203+
if (err) {
204+
return console.error(err);
205+
}
206+
});
207+
198208
// Cleanup
199209
fs.unlink('lumo-icons.woff', function (err) {
200210
if (err) {

packages/vaadin-lumo-styles/iconset.js

Lines changed: 3 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/vaadin-lumo-styles/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
"@polymer/iron-icon": "^3.0.0",
3434
"@polymer/iron-iconset-svg": "^3.0.0",
3535
"@polymer/polymer": "^3.0.0",
36+
"@vaadin/vaadin-icon": "^21.0.0-alpha2",
3637
"@vaadin/vaadin-themable-mixin": "^21.0.0-alpha2"
3738
},
3839
"devDependencies": {

0 commit comments

Comments
 (0)