Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 15 additions & 5 deletions packages/vaadin-lumo-styles/gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,14 +41,17 @@ function createIconset(folder, filenames, idPrefix = '') {
}

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

Expand Down Expand Up @@ -118,8 +121,8 @@ import './version.js';

const $_documentContainer = document.createElement('template');

$_documentContainer.innerHTML = \`<vaadin-iconset name="lumo">
${createIconset(folder, filenames, 'vaadin-icon:')}
$_documentContainer.innerHTML = \`<vaadin-iconset name="lumo" size="1000">
${createIconset(folder, filenames, 'lumo:')}
</vaadin-iconset>\`;\n\ndocument.head.appendChild($_documentContainer.content);\n`;

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

const list = glyphs.map((g) => g.name);
fs.writeFile('test/glyphs.json', JSON.stringify(list, null, 2), function (err) {
if (err) {
return console.error(err);
}
});

// Cleanup
fs.unlink('lumo-icons.woff', function (err) {
if (err) {
Expand Down
3 changes: 3 additions & 0 deletions packages/vaadin-lumo-styles/iconset.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions packages/vaadin-lumo-styles/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
"@polymer/iron-icon": "^3.0.0",
"@polymer/iron-iconset-svg": "^3.0.0",
"@polymer/polymer": "^3.0.0",
"@vaadin/vaadin-icon": "^21.0.0-alpha2",
"@vaadin/vaadin-themable-mixin": "^21.0.0-alpha2"
},
"devDependencies": {
Expand Down
Loading