@@ -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 ( / < p a t h d = " ( [ ^ " ] * ) " / ) ;
44+ const path = content . match ( / < p a t h ( f i l l - r u l e = " e v e n o d d " c l i p - r u l e = " e v e n o d d " ) * 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
119122const $_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 ) {
0 commit comments