diff --git a/demo/webfont.css b/demo/webfont.css new file mode 100644 index 00000000..5e67def0 --- /dev/null +++ b/demo/webfont.css @@ -0,0 +1,115 @@ +@font-face { + font-family: "webfont"; + font-style: normal; + font-weight: 400; + font-display: auto; + src: url("./webfont.eot?1565728069335"); + src: url("./webfont.eot?#iefix") format("embedded-opentype"), url("./webfont.woff2?1565728069335") format("woff2"), url("./webfont.woff?1565728069335") format("woff"), url("./webfont.ttf?1565728069335") format("truetype"), url("./webfont.svg?1565728069335#webfont") format("svg"); +} + +.webfont { + display: inline-block; + font-family: "webfont"; + font-weight: 400; + font-style: normal; + font-variant: normal; + text-rendering: auto; + line-height: 1; + -moz-osx-font-smoothing: grayscale; + -webkit-font-smoothing: antialiased; +} + +.webfont-lg { + font-size: 1.33333em; + line-height: 0.75em; + vertical-align: -0.0667em; +} + +.webfont-xs { + font-size: 0.75em; +} + +.webfont-sm { + font-size: 0.875em; +} + +.webfont-1x { + font-size: 1em; +} + +.webfont-2x { + font-size: 2em; +} + +.webfont-3x { + font-size: 3em; +} + +.webfont-4x { + font-size: 4em; +} + +.webfont-5x { + font-size: 5em; +} + +.webfont-6x { + font-size: 6em; +} + +.webfont-7x { + font-size: 7em; +} + +.webfont-8x { + font-size: 8em; +} + +.webfont-9x { + font-size: 9em; +} + +.webfont-10x { + font-size: 10em; +} + +.webfont-fw { + text-align: center; + width: 1.25em; +} + +.webfont-border { + border: solid 0.08em #eee; + border-radius: 0.1em; + padding: 0.2em 0.25em 0.15em; +} + +.webfont-pull-left { + float: left; +} + +.webfont-pull-right { + float: right; +} + +.webfont.webfont-pull-left { + margin-right: 0.3em; +} + +.webfont.webfont-pull-right { + margin-left: 0.3em; +} + + +.webfont-avatar::before { + content: "\ea01"; +} + +.webfont-envelope::before { + content: "\ea02"; +} + +.webfont-phone-call::before { + content: "\ea03"; +} + diff --git a/demo/webfont.eot b/demo/webfont.eot index fc726b0f..9a6c2532 100644 Binary files a/demo/webfont.eot and b/demo/webfont.eot differ diff --git a/demo/webfont.html b/demo/webfont.html index d5c7d451..83369f6a 100644 --- a/demo/webfont.html +++ b/demo/webfont.html @@ -51,8 +51,8 @@ font-style: normal; font-weight: 400; font-display: auto; - src: url("./webfont.eot"); - src: url("./webfont.eot?#iefix") format("embedded-opentype"), url("./webfont.woff2") format("woff2"), url("./webfont.woff") format("woff"), url("./webfont.ttf") format("truetype"), url("./webfont.svg#webfont") format("svg"); + src: url("./webfont.eot?1565728045067"); + src: url("./webfont.eot?#iefix") format("embedded-opentype"), url("./webfont.woff2?1565728045067") format("woff2"), url("./webfont.woff?1565728045067") format("woff"), url("./webfont.ttf?1565728045067") format("truetype"), url("./webfont.svg?1565728045067#webfont") format("svg"); } .webfont { diff --git a/demo/webfont.json b/demo/webfont.json new file mode 100644 index 00000000..4e11dae4 --- /dev/null +++ b/demo/webfont.json @@ -0,0 +1,17 @@ +[ + { + "id": "avatar", + "name": "Avatar", + "unicode": ["ea01", "avatar"] + }, + { + "id": "envelope", + "name": "Envelope", + "unicode": ["ea02", "envelope"] + }, + { + "id": "phone-call", + "name": "Phone Call", + "unicode": ["ea03", "phone_call"] + } +] diff --git a/demo/webfont.scss b/demo/webfont.scss new file mode 100644 index 00000000..407989ce --- /dev/null +++ b/demo/webfont.scss @@ -0,0 +1,127 @@ + + $webfont-avatar: "\ea01"; + + $webfont-envelope: "\ea02"; + + $webfont-phone-call: "\ea03"; + + +@font-face { + font-family: "webfont"; + font-style: normal; + font-weight: 400; + font-display: auto; + src: url("./webfont.eot?1565728077137"); + src: url("./webfont.eot?#iefix") format("embedded-opentype"), url("./webfont.woff2?1565728077137") format("woff2"), url("./webfont.woff?1565728077137") format("woff"), url("./webfont.ttf?1565728077137") format("truetype"), url("./webfont.svg?1565728077137#webfont") format("svg"); +} + +%webfont { +display: inline-block; + font-family: "webfont"; + font-weight: 400; + font-style: normal; + font-variant: normal; + text-rendering: auto; + line-height: 1; + -moz-osx-font-smoothing: grayscale; + -webkit-font-smoothing: antialiased; +} + +.webfont { + @extend %webfont; +} + +.webfont-lg { + font-size: 1.33333em; + line-height: 0.75em; + vertical-align: -0.0667em; +} + +.webfont-xs { + font-size: 0.75em; +} + +.webfont-sm { + font-size: 0.875em; +} + +.webfont-1x { + font-size: 1em; +} + +.webfont-2x { + font-size: 2em; +} + +.webfont-3x { + font-size: 3em; +} + +.webfont-4x { + font-size: 4em; +} + +.webfont-5x { + font-size: 5em; +} + +.webfont-6x { + font-size: 6em; +} + +.webfont-7x { + font-size: 7em; +} + +.webfont-8x { + font-size: 8em; +} + +.webfont-9x { + font-size: 9em; +} + +.webfont-10x { + font-size: 10em; +} + +.webfont-fw { + text-align: center; + width: 1.25em; +} + +.webfont-border { + border: solid 0.08em #eee; + border-radius: 0.1em; + padding: 0.2em 0.25em 0.15em; +} + +.webfont-pull-left { + float: left; +} + +.webfont-pull-right { + float: right; +} + +.webfont.webfont-pull-left { + margin-right: 0.3em; +} + +.webfont.webfont-pull-right { + margin-left: 0.3em; +} + + +.webfont-avatar::before { + content: "\ea01"; +} + +.webfont-envelope::before { + content: "\ea02"; +} + +.webfont-phone-call::before { + content: "\ea03"; +} + diff --git a/demo/webfont.svg b/demo/webfont.svg index b1baff2d..6d70b061 100644 --- a/demo/webfont.svg +++ b/demo/webfont.svg @@ -2,29 +2,29 @@ - + + horiz-adv-x="1000" d="M496.3760612963346 461.1720853178712C497.4114723545247 461.1720853178712 498.4468834127148 461.1720853178712 499.689376682543 461.1720853178712C500.103541105819 461.1720853178712 500.5177055290951 461.1720853178712 500.9318699523711 461.1720853178712C501.5531165872852 461.1720853178712 502.3814454338371 461.1720853178712 503.0026920687512 461.1720853178712C563.6777800786912 462.2074963760613 612.756264236902 483.5369641747774 648.9956512735556 524.3321598674675C728.7223027541934 614.2058397183682 715.4690412093602 768.2750051770553 714.0194657278939 782.9778422033547C708.8424104369434 893.3526610064196 656.6576931041623 946.1586249741148 613.584593083454 970.8014081590392C581.486850279561 989.231724994823 544.0049699730793 999.171671153448 502.1743632221992 1000H500.7247877407331C500.5177055290951 1000 500.103541105819 1000 499.896458894181 1000H498.6539656243529C475.6678401325327 1000 430.5239179954442 996.2725201905156 387.243735763098 971.6297370055912C343.7564713191137 946.9869538206668 290.7434251397806 894.1809898529716 285.56636984883 782.9778422033547C284.1167943673639 768.2750051770553 270.8635328225306 614.2058397183682 350.5901843031684 524.3321598674675C386.6224891281839 483.5369641747774 435.7009732863948 462.2074963760613 496.3760612963346 461.1720853178712zM340.8573203561814 777.8007869124042C340.8573203561814 778.4220335473183 341.0644025678194 779.0432801822324 341.0644025678194 779.4574446055084C347.8981155518741 927.9353903499688 453.3029612756264 943.8807206460966 498.4468834127148 943.8807206460966H499.2752122592669C499.689376682543 943.8807206460966 500.310623317457 943.8807206460966 500.9318699523711 943.8807206460966C556.8440670946366 942.6382273762684 651.8948022364879 919.8591840960862 658.3143507972665 779.4574446055084C658.3143507972665 778.8361979705943 658.3143507972665 778.2149513356803 658.5214330089045 777.8007869124042C658.7285152205426 776.3512114309381 673.2242700352041 635.5353075170842 607.3721267343136 561.399875750673C581.279768067923 531.9942016980741 546.4899565127356 517.4984468834127 500.7247877407331 517.0842824601366C500.3106233174571 517.0842824601366 500.103541105819 517.0842824601366 499.689376682543 517.0842824601366L499.689376682543 517.0842824601366C499.275212259267 517.0842824601366 499.0681300476289 517.0842824601366 498.6539656243529 517.0842824601366C453.0958790639884 517.4984468834127 418.098985297163 531.994201698074 392.2137088424105 561.399875750673C326.568647753158 635.1211430938083 340.6502381445434 776.558293642576 340.8573203561814 777.8007869124042zM925.2433215986746 205.6326361565541C925.2433215986746 205.8397183681922 925.2433215986746 206.0468005798301 925.2433215986746 206.2538827914682C925.2433215986746 207.9105404845724 925.0362393870366 209.5671981776766 925.0362393870366 211.4309380824187C923.7937461172085 252.4332159867468 921.1016773659142 348.31227997515 831.2279975150134 378.9604472975772C830.6067508800993 379.1675295092153 829.7784220335473 379.3746117208532 829.1571753986332 379.5816939324913C735.7630979498861 403.3961482708636 658.1072685856284 457.2375232967489 657.2789397390763 457.858769931663C644.6469248291571 466.7633050320978 627.2520190515635 463.6570718575275 618.3474839511285 451.0250569476083C609.4429488506936 438.393042037689 612.5491820252639 420.9981362600953 625.1811969351833 412.0936011596605C628.7015945330296 409.6086146200043 711.1203147649617 352.2468419962726 814.2472561606958 325.7403189066061C862.4974114723545 308.5524953406503 867.881548974943 256.9890246427833 869.3311244564093 209.7742803893147C869.3311244564093 207.9105404845725 869.3311244564093 206.2538827914683 869.5382066680473 204.5972250983641C869.7452888796854 185.9598260509423 868.5027956098572 157.1753986332575 865.1894802236488 140.6088217022159C831.6421619382895 121.5572582315181 700.1449575481466 55.7051149306276 500.103541105819 55.7051149306276C300.8904535100436 55.7051149306276 168.5649202733485 121.764340443156 134.8105197763512 140.815903913854C131.4972043901429 157.3824808448956 130.0476289086767 186.1669082625804 130.4617933319528 204.8043073100022C130.4617933319528 206.4609650031064 130.6688755435908 208.1176226962106 130.6688755435908 209.9813626009527C132.118451025057 257.1961068544214 137.5025885276455 308.7595775522883 185.7527438393042 325.9474011182441C288.8796852350383 352.4539242079107 371.2984054669704 410.0227790432804 374.8188030648168 412.3006833712986C387.450817974736 421.2052184717334 390.5570511493063 438.600124249327 381.6525160488714 451.2321391592463C372.7479809484365 463.8641540691656 355.3530751708429 466.9703872437359 342.7210602609236 458.0658521433011C341.8927314143715 457.444605508387 264.65106647339 403.6032304825017 170.8428246013668 379.7887761441293C170.0144957548147 379.5816939324913 169.3932491199006 379.3746117208533 168.7720024849865 379.1675295092153C78.8983226340857 348.3122799751503 76.2062538827915 252.4332159867469 74.9637606129634 211.6380202940569C74.9637606129634 209.7742803893148 74.9637606129634 208.1176226962106 74.7566784013253 206.4609650031064C74.7566784013253 206.2538827914683 74.7566784013253 206.0468005798304 74.7566784013253 205.8397183681923C74.5495961896873 195.0714433630152 74.3425139780493 139.7804928556639 85.3178711948644 112.031476496169C87.3886933112446 106.6473389935804 91.1161731207289 102.0915303375441 96.0861462000414 98.9852971629738C102.298612549182 94.8436529302134 251.1907227169187 0 500.310623317457 0S898.3226340857319 95.0507351418513 904.5351004348726 98.9852971629738C909.297991302547 102.0915303375441 913.2325533236694 106.6473389935804 915.3033754400496 112.031476496169C925.6574860219508 139.5734106440257 925.4504038103127 194.864361151377 925.2433215986746 205.6326361565541z" /> + horiz-adv-x="1000" d="M496.3760612963346 461.1720853178712C497.4114723545247 461.1720853178712 498.4468834127148 461.1720853178712 499.689376682543 461.1720853178712C500.103541105819 461.1720853178712 500.5177055290951 461.1720853178712 500.9318699523711 461.1720853178712C501.5531165872852 461.1720853178712 502.3814454338371 461.1720853178712 503.0026920687512 461.1720853178712C563.6777800786912 462.2074963760613 612.756264236902 483.5369641747774 648.9956512735556 524.3321598674675C728.7223027541934 614.2058397183682 715.4690412093602 768.2750051770553 714.0194657278939 782.9778422033547C708.8424104369434 893.3526610064196 656.6576931041623 946.1586249741148 613.584593083454 970.8014081590392C581.486850279561 989.231724994823 544.0049699730793 999.171671153448 502.1743632221992 1000H500.7247877407331C500.5177055290951 1000 500.103541105819 1000 499.896458894181 1000H498.6539656243529C475.6678401325327 1000 430.5239179954442 996.2725201905156 387.243735763098 971.6297370055912C343.7564713191137 946.9869538206668 290.7434251397806 894.1809898529716 285.56636984883 782.9778422033547C284.1167943673639 768.2750051770553 270.8635328225306 614.2058397183682 350.5901843031685 524.3321598674675C386.6224891281839 483.5369641747774 435.7009732863948 462.2074963760613 496.3760612963346 461.1720853178712zM340.8573203561814 777.8007869124042C340.8573203561814 778.4220335473183 341.0644025678194 779.0432801822324 341.0644025678194 779.4574446055084C347.8981155518742 927.9353903499688 453.3029612756264 943.8807206460966 498.4468834127148 943.8807206460966H499.2752122592669C499.689376682543 943.8807206460966 500.310623317457 943.8807206460966 500.9318699523711 943.8807206460966C556.8440670946366 942.6382273762684 651.8948022364879 919.8591840960862 658.3143507972665 779.4574446055084C658.3143507972665 778.8361979705943 658.3143507972665 778.2149513356803 658.5214330089045 777.8007869124042C658.7285152205426 776.3512114309381 673.2242700352041 635.5353075170842 607.3721267343136 561.399875750673C581.279768067923 531.9942016980741 546.4899565127356 517.4984468834127 500.7247877407331 517.0842824601366C500.3106233174571 517.0842824601366 500.103541105819 517.0842824601366 499.689376682543 517.0842824601366L499.689376682543 517.0842824601366C499.275212259267 517.0842824601366 499.0681300476289 517.0842824601366 498.6539656243529 517.0842824601366C453.0958790639884 517.4984468834127 418.098985297163 531.994201698074 392.2137088424105 561.399875750673C326.568647753158 635.1211430938083 340.6502381445434 776.558293642576 340.8573203561814 777.8007869124042zM925.2433215986746 205.6326361565541C925.2433215986746 205.8397183681922 925.2433215986746 206.0468005798301 925.2433215986746 206.2538827914682C925.2433215986746 207.9105404845724 925.0362393870366 209.5671981776766 925.0362393870366 211.4309380824187C923.7937461172085 252.4332159867468 921.1016773659142 348.31227997515 831.2279975150134 378.9604472975772C830.6067508800993 379.1675295092153 829.7784220335473 379.3746117208532 829.1571753986332 379.5816939324913C735.7630979498861 403.3961482708636 658.1072685856284 457.2375232967489 657.2789397390763 457.858769931663C644.6469248291571 466.7633050320978 627.2520190515635 463.6570718575275 618.3474839511285 451.0250569476083C609.4429488506936 438.393042037689 612.5491820252639 420.9981362600953 625.1811969351833 412.0936011596605C628.7015945330296 409.6086146200043 711.1203147649617 352.2468419962726 814.2472561606958 325.7403189066061C862.4974114723545 308.5524953406503 867.881548974943 256.9890246427833 869.3311244564093 209.7742803893147C869.3311244564093 207.9105404845725 869.3311244564093 206.2538827914683 869.5382066680473 204.5972250983641C869.7452888796854 185.9598260509423 868.5027956098572 157.1753986332575 865.1894802236488 140.6088217022159C831.6421619382895 121.5572582315181 700.1449575481466 55.7051149306276 500.103541105819 55.7051149306276C300.8904535100436 55.7051149306276 168.5649202733485 121.764340443156 134.8105197763512 140.815903913854C131.4972043901429 157.3824808448956 130.0476289086767 186.1669082625804 130.4617933319528 204.8043073100022C130.4617933319528 206.4609650031064 130.6688755435908 208.1176226962106 130.6688755435908 209.9813626009527C132.118451025057 257.1961068544214 137.5025885276455 308.7595775522883 185.7527438393042 325.9474011182441C288.8796852350383 352.4539242079107 371.2984054669704 410.0227790432804 374.8188030648168 412.3006833712986C387.4508179747361 421.2052184717334 390.5570511493063 438.600124249327 381.6525160488714 451.2321391592463C372.7479809484365 463.8641540691656 355.3530751708429 466.9703872437359 342.7210602609236 458.0658521433011C341.8927314143715 457.444605508387 264.65106647339 403.6032304825017 170.8428246013668 379.7887761441293C170.0144957548147 379.5816939324913 169.3932491199006 379.3746117208533 168.7720024849865 379.1675295092153C78.8983226340857 348.3122799751503 76.2062538827915 252.4332159867469 74.9637606129634 211.6380202940569C74.9637606129634 209.7742803893148 74.9637606129634 208.1176226962106 74.7566784013253 206.4609650031064C74.7566784013253 206.2538827914683 74.7566784013253 206.0468005798304 74.7566784013253 205.8397183681923C74.5495961896873 195.0714433630152 74.3425139780493 139.7804928556639 85.3178711948644 112.031476496169C87.3886933112446 106.6473389935804 91.1161731207289 102.0915303375441 96.0861462000414 98.9852971629738C102.298612549182 94.8436529302134 251.1907227169187 0 500.310623317457 0S898.3226340857319 95.0507351418513 904.5351004348726 98.9852971629738C909.297991302547 102.0915303375441 913.2325533236694 106.6473389935804 915.3033754400496 112.031476496169C925.6574860219508 139.5734106440257 925.4504038103127 194.864361151377 925.2433215986746 205.6326361565541z" /> + horiz-adv-x="1000" d="M877.9226153527829 880.5090006207324H122.284295468653C54.8313676805297 880.5090006207324 0 825.6776329402028 0 758.2247051520794V241.7752948479206C0 174.3223670597972 54.8313676805297 119.4909993792676 122.284295468653 119.4909993792676H877.715704531347C945.1686323194704 119.4909993792676 1000.0000000000002 174.3223670597972 1000.0000000000002 241.7752948479206V758.0177943306435C1000.2069108214358 825.4707221187668 945.3755431409062 880.5090006207324 877.9226153527829 880.5090006207324zM944.3409890337264 241.7752948479206C944.3409890337264 205.1520794537555 914.545830746948 175.356921166977 877.9226153527828 175.356921166977H122.284295468653C85.6610800744879 175.356921166977 55.8659217877095 205.1520794537554 55.8659217877095 241.7752948479206V758.0177943306435C55.8659217877095 794.6410097248087 85.6610800744879 824.436168011587 122.284295468653 824.436168011587H877.715704531347C914.338919925512 824.436168011587 944.1340782122905 794.6410097248086 944.1340782122905 758.0177943306435V241.7752948479206H944.3409890337264zM630.6641837368094 506.4142354645148L875.2327746741154 725.7397061866336C886.6128698530932 736.0852472584315 887.647423960273 753.6726670804883 877.301882888475 765.2596730809021C866.956341816677 776.6397682598799 849.3689219946202 777.6743223670597 837.7819159942064 767.3287812952617L500.5172770535899 464.6182495344507L434.7196358369542 523.3809228222636C434.5127250155183 523.5878336436996 434.3058141940823 523.7947444651355 434.3058141940823 524.0016552865716C432.8574384440306 525.4500310366233 431.4090626939788 526.691495965239 429.7537761224912 527.9329608938549L162.0111731843575 767.5356921166978C150.4241671839437 777.8812331884958 132.836747361887 776.846679081316 122.491206290089 765.2596730809022C112.1456652182909 753.6726670804884 113.1802193254707 736.0852472584317 124.7672253258845 725.7397061866336L372.232567763294 504.5520380715912L125.8017794330644 273.8464721704946C114.6285950755225 263.2940202772606 114.0078626112146 245.7066004552038 124.5603145044486 234.326505276226C130.1469066832195 228.5330022760191 137.5956962549141 225.4293399544796 145.0444858266087 225.4293399544796C151.8725429339954 225.4293399544796 158.7006000413821 227.9122698117111 164.0802813987172 232.8781295261743L414.2354645147941 466.8942685702463L482.1022139457893 406.2693978895097C487.4818953031243 401.5104489964825 494.1030415890751 399.2344299606871 500.7241878750258 399.2344299606871C507.3453341609766 399.2344299606871 514.1733912683633 401.7173598179186 519.3461618042624 406.4763087109457L589.0751086281812 468.9633767846059L837.7819159942064 232.6712187047384C843.1615973515414 227.4984481688394 850.1965652803641 225.0155183116078 857.0246223877508 225.0155183116078C864.4734119594455 225.0155183116078 871.715290709704 227.9122698117112 877.301882888475 233.7057728119182C887.8543347817091 244.87895716946 887.4405131388371 262.6732878129527 876.2673287812952 273.2257397061868L630.6641837368094 506.4142354645148z" /> + horiz-adv-x="1000" d="M877.9226153527829 880.5090006207324H122.284295468653C54.8313676805297 880.5090006207324 0 825.6776329402028 0 758.2247051520794V241.7752948479206C0 174.3223670597972 54.8313676805297 119.4909993792676 122.284295468653 119.4909993792676H877.715704531347C945.1686323194704 119.4909993792676 1000.0000000000002 174.3223670597972 1000.0000000000002 241.7752948479206V758.0177943306435C1000.2069108214358 825.4707221187668 945.3755431409062 880.5090006207324 877.9226153527829 880.5090006207324zM944.3409890337264 241.7752948479206C944.3409890337264 205.1520794537555 914.545830746948 175.356921166977 877.9226153527828 175.356921166977H122.284295468653C85.6610800744879 175.356921166977 55.8659217877095 205.1520794537554 55.8659217877095 241.7752948479206V758.0177943306435C55.8659217877095 794.6410097248087 85.6610800744879 824.436168011587 122.284295468653 824.436168011587H877.715704531347C914.338919925512 824.436168011587 944.1340782122905 794.6410097248086 944.1340782122905 758.0177943306435V241.7752948479206H944.3409890337264zM630.6641837368094 506.4142354645148L875.2327746741154 725.7397061866336C886.6128698530932 736.0852472584315 887.647423960273 753.6726670804883 877.301882888475 765.2596730809021C866.956341816677 776.6397682598799 849.3689219946202 777.6743223670597 837.7819159942064 767.3287812952617L500.5172770535899 464.6182495344507L434.7196358369542 523.3809228222636C434.5127250155183 523.5878336436996 434.3058141940823 523.7947444651355 434.3058141940823 524.0016552865716C432.8574384440306 525.4500310366233 431.4090626939788 526.691495965239 429.7537761224912 527.9329608938549L162.0111731843575 767.5356921166978C150.4241671839437 777.8812331884958 132.836747361887 776.846679081316 122.491206290089 765.2596730809022C112.1456652182909 753.6726670804884 113.1802193254707 736.0852472584317 124.7672253258845 725.7397061866336L372.232567763294 504.5520380715912L125.8017794330644 273.8464721704946C114.6285950755225 263.2940202772606 114.0078626112146 245.7066004552038 124.5603145044486 234.326505276226C130.1469066832195 228.5330022760191 137.5956962549141 225.4293399544796 145.0444858266087 225.4293399544796C151.8725429339954 225.4293399544796 158.7006000413821 227.9122698117111 164.0802813987172 232.8781295261743L414.2354645147941 466.8942685702463L482.1022139457893 406.2693978895097C487.4818953031243 401.5104489964825 494.1030415890751 399.2344299606871 500.7241878750258 399.2344299606871C507.3453341609766 399.2344299606871 514.1733912683633 401.7173598179186 519.3461618042624 406.4763087109457L589.0751086281812 468.9633767846059L837.7819159942064 232.6712187047384C843.1615973515414 227.4984481688394 850.1965652803641 225.0155183116078 857.0246223877508 225.0155183116078C864.4734119594455 225.0155183116078 871.715290709704 227.9122698117112 877.301882888475 233.7057728119182C887.8543347817091 244.87895716946 887.4405131388371 262.6732878129527 876.2673287812952 273.2257397061868L630.6641837368094 506.4142354645148z" /> + horiz-adv-x="1000" d="M790.3150234484157 380.5354934298004C769.8425093814769 401.8522348809429 745.1488583935198 413.2493045676923 718.9778094832063 413.2493045676923C693.0178174189437 413.2493045676923 668.1131095849356 402.0632917269938 646.7963681337933 380.7465502758514L580.102404781704 314.2636437698131C574.6149267843801 317.2184396145258 569.1274487870563 319.9621786131877 563.8510276357835 322.7059176118496C556.2529811779505 326.5049408407662 549.0770484122194 330.0929072236317 542.9563998767429 333.8919304525482C480.483573445672 373.5706175101203 423.7092818579757 425.2795447925945 369.2566155768395 492.1845649907347C342.8745098204751 525.5315466667794 325.1457347521982 553.6021071915511 312.2712671430924 582.0947814084246C329.5779285192674 597.9240448622434 345.618248819137 614.3864788542147 361.2364554269048 630.2157423080334C367.1460471163304 636.1253339974589 373.055638805756 642.2459825329355 378.9652304951817 648.1555742223611C423.2871681658739 692.4775118930534 423.2871681658739 749.8849740189023 378.9652304951817 794.2069116895946L321.3467115232818 851.8254306614945C314.8039492957033 858.3681928890728 308.050130222074 865.1220119627021 301.7184248405466 871.8758310363314C289.0550140774917 884.9613554914882 275.758432776284 898.4689936387468 262.0397377829745 911.1324044018018C241.5672237160357 931.3938616226897 217.0846295741295 942.1577607712862 191.3356943559178 942.1577607712862S140.6820513036981 931.3938616226897 119.5763666986066 911.1324044018018C119.3653098525557 910.9213475557508 119.3653098525557 910.9213475557508 119.1542530065048 910.7102907096998L47.3949253491935 838.3177925142359C20.3796490546764 811.3025162197188 4.9724992929595 778.377648235776 1.5955897561449 740.1763591005603C-3.4697745490771 678.547760053693 14.6811142113017 621.1402979278439 28.6108660506621 583.5721793307811C62.8020751109104 491.3403376065311 113.8778318552319 405.8623149559104 190.0693532796123 314.2636437698131C282.5122518499133 203.8809132851843 393.7392097187457 116.7144358661562 520.7954310413967 55.2968936653399C569.3385056331072 32.2916974457902 634.1329573707382 5.065364305222 706.5254555662021 0.4221136921019C710.9576493332714 0.211056846051 715.6008999463916 1e-13 719.8220368674099 1e-13C768.5761683051713 1e-13 809.5211964390489 17.5177182222261 841.6018370387881 52.3420978206271C841.812893884839 52.7642115127289 842.2350075769408 52.9752683587799 842.4460644229916 53.3973820508817C853.4210204176392 66.6939633520893 866.0844311806942 78.7242035769915 879.3810124819018 91.5986711860975C888.4564568620913 100.252001874185 897.7429580883314 109.3274462543743 906.8184024685208 118.8250043266654C927.7130302275614 140.5638594699098 938.6879862222092 165.8906809960196 938.6879862222092 191.8506730602823C938.6879862222092 218.0217219705957 927.5019733815107 243.1374866506547 906.1852319303682 264.2431712557463L790.3150234484157 380.5354934298004zM865.8733743346432 158.2926345381865C865.6623174885924 158.2926345381865 865.6623174885924 158.0815776921355 865.8733743346432 158.2926345381865C857.6421573386576 149.4282470040481 849.199883496621 141.4080868541132 840.1244391164316 132.5436993199749C826.4057441231222 119.4581748648182 812.4759922837617 105.7394798715086 799.390467828605 90.3323301097918C778.0737263774624 67.5381907362929 752.9579616974036 56.7742915876962 720.0330937134607 56.7742915876962C716.867241022697 56.7742915876962 713.4903314858823 56.7742915876962 710.3244787951186 56.9853484337473C647.6405955179968 60.9954285087146 589.388906007944 85.4780226506208 545.7001388754046 106.3726504096613C426.2419640105865 164.2022262276122 321.3467115232815 246.3033393414184 234.1802341042535 350.3543644445196C162.2098496008914 437.0987281714459 114.0888887012827 517.3003296707936 82.2193049475945 603.4115228595672C62.5910182648593 655.964677526245 55.4150854991282 696.9097056601227 58.5809381898919 735.5331084874401C60.6915066504011 760.2267594753972 70.1890647226923 780.6992735423361 87.7067829449183 798.216991764562L159.6771674482804 870.1873762679242C170.0189529047753 879.8959911862663 180.9939088994229 885.1724123375392 191.7578080480196 885.1724123375392C205.0543893492272 885.1724123375392 215.8182884978239 877.1522521876044 222.5721075714532 870.3984331139751C222.7831644175041 870.1873762679242 222.994221263555 869.9763194218732 223.2052781096059 869.7652625758224C236.0797457187118 857.7350223509202 248.3210427896649 845.2826684339161 261.1955103987707 831.9860871327085C267.7382726263491 825.2322680590792 274.4920916999784 818.4784489854499 281.2459107736076 811.5135730657697L338.8644297455076 753.8950540938698C361.2364554269046 731.5230284124727 361.2364554269046 710.839457499483 338.8644297455076 688.467431818086C332.743781210031 682.3467832826095 326.8341895206054 676.226134747133 320.7135409851288 670.3165430577073C302.984765916852 652.1656542973286 286.1002182327787 635.2811066132554 267.7382726263491 618.8186726212839C267.3161589342473 618.3965589291822 266.8940452421454 618.1855020831313 266.6829883960945 617.7633883910294C248.5320996357158 599.6124996306507 251.9090091725304 581.8837245623738 255.7080324014469 569.8534843374716C255.9190892474978 569.2203137993189 256.1301460935487 568.5871432611661 256.3412029395996 567.9539727230134C271.3262390092146 531.6521952022559 292.4319236143062 497.4609861420076 324.5125642140453 456.727014854181L324.7236210600962 456.51595800813C382.9753105701488 384.7566303508188 444.3928527709652 328.8265661473263 512.1421003533089 285.9820263989905C520.7954310413965 280.4945484016665 529.6598185755349 276.0623546345975 538.1020924175716 271.8412177135791C545.7001388754046 268.0421944846626 552.8760716411357 264.4542281017971 558.9967201766121 260.6552048728805C559.8409475608157 260.2330911807788 560.6851749450195 259.599920642626 561.5294023292231 259.1778069505242C568.7053350949542 255.5898405676586 575.4591541685836 253.9013857992514 582.4240300882637 253.9013857992514C599.9417483104897 253.9013857992514 610.9167043051373 264.8763417938989 614.5046706880028 268.4643081767644L686.6861120374158 340.6457495261774C693.8620448031469 347.8216822919085 705.2591144898964 356.4750129799961 718.5556957911041 356.4750129799961C731.6412202462608 356.4750129799961 742.4051193948576 348.2437959840105 748.9478816224358 341.0678632182793C749.1589384684868 340.8568063722284 749.1589384684868 340.8568063722284 749.3699953145377 340.6457495261774L865.6623174885921 224.3534273521231C887.4011726318367 202.8256290549296 887.4011726318367 180.6646602195834 865.8733743346432 158.2926345381865zM540.4237177241318 762.1262710898553C595.7206113894716 752.8397698636151 645.9521407495895 726.6687209533015 686.0529414992634 686.5679202036276S752.1137343132 596.2355900938359 761.6112923854912 540.9386964284961C763.9329176920513 527.0089445891356 775.9631579169534 517.3003296707935 789.6818529102629 517.3003296707935C791.3703076786703 517.3003296707935 792.8477056010266 517.5113865168444 794.536160369434 517.7224433628953C810.1543669772017 520.2551255155063 820.4961524336966 535.0291047390704 817.9634702810856 550.6473113468381C806.5664005943363 617.5523315449782 774.907873686699 678.5477600536929 726.5758559410393 726.8797777993525S617.2484096866651 806.8703224526494 550.343389488525 818.2673921393988C534.7251828807572 820.8000742920098 520.162260503244 810.4582888355148 517.4185215045821 795.0511390737981S524.8055111163642 764.6589532424663 540.4237177241318 762.1262710898553zM998.83918734672 558.8785283428238C980.0551280481886 669.0502019814016 928.1351439196632 769.3022038555864 848.3556561124173 849.0816916628324S668.3241664309865 980.7811635986036 558.1524927924087 999.565222897135C542.7453430306919 1002.308961895797 528.1824206531787 991.7561195932512 525.4386816545168 976.3489698315344C522.9059995019059 960.7307632237666 533.2477849584006 946.1678408462536 548.8659915661684 943.4241018475916C647.2184818258951 926.7506110095692 736.917641397534 880.107048032317 808.2548553627435 808.9808909131585C879.5920693279529 737.6436769479492 926.0245754591544 647.9445173763102 942.6980662971766 549.5920271165835C945.0196916037366 535.6622752772232 957.0499318286388 525.953660358881 970.7686268219484 525.953660358881C972.4570815903556 525.953660358881 973.934479512712 526.164717204932 975.6229342811195 526.3757740509828C991.0300840428362 528.697399357543 1001.582926345382 543.471378581107 998.83918734672 558.8785283428238z" /> + horiz-adv-x="1000" d="M790.3150234484157 380.5354934298004C769.8425093814769 401.8522348809429 745.1488583935198 413.2493045676923 718.9778094832063 413.2493045676923C693.0178174189437 413.2493045676923 668.1131095849356 402.0632917269938 646.7963681337933 380.7465502758514L580.102404781704 314.2636437698131C574.6149267843801 317.2184396145258 569.1274487870563 319.9621786131877 563.8510276357835 322.7059176118496C556.2529811779505 326.5049408407662 549.0770484122194 330.0929072236317 542.9563998767429 333.8919304525482C480.483573445672 373.5706175101203 423.7092818579757 425.2795447925945 369.2566155768395 492.1845649907347C342.8745098204751 525.5315466667794 325.1457347521982 553.6021071915511 312.2712671430924 582.0947814084246C329.5779285192674 597.9240448622434 345.618248819137 614.3864788542147 361.2364554269048 630.2157423080334C367.1460471163304 636.1253339974589 373.055638805756 642.2459825329355 378.9652304951817 648.1555742223611C423.2871681658739 692.4775118930534 423.2871681658739 749.8849740189023 378.9652304951817 794.2069116895946L321.3467115232818 851.8254306614945C314.8039492957033 858.3681928890728 308.050130222074 865.1220119627021 301.7184248405466 871.8758310363314C289.0550140774917 884.9613554914882 275.758432776284 898.4689936387468 262.0397377829745 911.1324044018018C241.5672237160357 931.3938616226897 217.0846295741295 942.1577607712862 191.3356943559178 942.1577607712862S140.6820513036981 931.3938616226897 119.5763666986066 911.1324044018018C119.3653098525557 910.9213475557508 119.3653098525557 910.9213475557508 119.1542530065048 910.7102907096998L47.3949253491935 838.3177925142359C20.3796490546764 811.3025162197188 4.9724992929595 778.377648235776 1.5955897561449 740.1763591005603C-3.4697745490771 678.547760053693 14.6811142113017 621.1402979278439 28.6108660506621 583.5721793307811C62.8020751109104 491.3403376065311 113.8778318552319 405.8623149559104 190.0693532796123 314.2636437698131C282.5122518499133 203.8809132851843 393.7392097187457 116.7144358661562 520.7954310413967 55.2968936653399C569.3385056331072 32.2916974457902 634.1329573707382 5.065364305222 706.5254555662021 0.4221136921019C710.9576493332714 0.211056846051 715.6008999463916 1e-13 719.8220368674099 1e-13C768.5761683051713 1e-13 809.5211964390489 17.5177182222261 841.6018370387881 52.3420978206271C841.812893884839 52.7642115127289 842.2350075769408 52.9752683587799 842.4460644229916 53.3973820508817C853.4210204176392 66.6939633520893 866.0844311806942 78.7242035769915 879.3810124819018 91.5986711860975C888.4564568620913 100.252001874185 897.7429580883314 109.3274462543743 906.8184024685208 118.8250043266654C927.7130302275614 140.5638594699098 938.6879862222092 165.8906809960196 938.6879862222092 191.8506730602823C938.6879862222092 218.0217219705957 927.5019733815107 243.1374866506547 906.1852319303682 264.2431712557463L790.3150234484157 380.5354934298004zM865.8733743346432 158.2926345381865C865.6623174885924 158.2926345381865 865.6623174885924 158.0815776921355 865.8733743346432 158.2926345381865C857.6421573386576 149.4282470040481 849.199883496621 141.4080868541132 840.1244391164316 132.5436993199749C826.4057441231222 119.4581748648182 812.4759922837617 105.7394798715086 799.390467828605 90.3323301097918C778.0737263774624 67.5381907362929 752.9579616974036 56.7742915876962 720.0330937134607 56.7742915876962C716.867241022697 56.7742915876962 713.4903314858823 56.7742915876962 710.3244787951186 56.9853484337473C647.6405955179968 60.9954285087146 589.388906007944 85.4780226506208 545.7001388754046 106.3726504096613C426.2419640105865 164.2022262276122 321.3467115232815 246.3033393414184 234.1802341042535 350.3543644445196C162.2098496008914 437.0987281714459 114.0888887012827 517.3003296707936 82.2193049475945 603.4115228595672C62.5910182648593 655.964677526245 55.4150854991282 696.9097056601227 58.5809381898919 735.5331084874401C60.6915066504011 760.2267594753972 70.1890647226923 780.6992735423361 87.7067829449183 798.216991764562L159.6771674482804 870.1873762679242C170.0189529047753 879.8959911862663 180.9939088994229 885.1724123375392 191.7578080480196 885.1724123375392C205.0543893492272 885.1724123375392 215.8182884978239 877.1522521876044 222.5721075714532 870.3984331139751C222.7831644175041 870.1873762679242 222.994221263555 869.9763194218732 223.2052781096059 869.7652625758224C236.0797457187118 857.7350223509202 248.3210427896649 845.2826684339161 261.1955103987707 831.9860871327085C267.7382726263491 825.2322680590792 274.4920916999784 818.4784489854499 281.2459107736076 811.5135730657697L338.8644297455076 753.8950540938698C361.2364554269047 731.5230284124727 361.2364554269047 710.839457499483 338.8644297455076 688.467431818086C332.743781210031 682.3467832826095 326.8341895206054 676.226134747133 320.7135409851288 670.3165430577073C302.984765916852 652.1656542973286 286.1002182327787 635.2811066132554 267.7382726263491 618.8186726212839C267.3161589342473 618.3965589291822 266.8940452421454 618.1855020831313 266.6829883960945 617.7633883910294C248.5320996357158 599.6124996306507 251.9090091725304 581.8837245623738 255.7080324014469 569.8534843374716C255.9190892474978 569.2203137993189 256.1301460935487 568.5871432611661 256.3412029395996 567.9539727230134C271.3262390092146 531.6521952022559 292.4319236143062 497.4609861420076 324.5125642140453 456.727014854181L324.7236210600962 456.51595800813C382.9753105701488 384.7566303508188 444.3928527709652 328.8265661473263 512.1421003533089 285.9820263989905C520.7954310413965 280.4945484016665 529.6598185755349 276.0623546345975 538.1020924175716 271.8412177135791C545.7001388754046 268.0421944846626 552.8760716411357 264.4542281017972 558.9967201766121 260.6552048728805C559.8409475608157 260.2330911807788 560.6851749450195 259.599920642626 561.5294023292231 259.1778069505242C568.7053350949542 255.5898405676586 575.4591541685836 253.9013857992514 582.4240300882637 253.9013857992514C599.9417483104897 253.9013857992514 610.9167043051373 264.8763417938989 614.5046706880028 268.4643081767644L686.6861120374158 340.6457495261774C693.8620448031469 347.8216822919085 705.2591144898964 356.4750129799961 718.5556957911041 356.4750129799961C731.6412202462608 356.4750129799961 742.4051193948576 348.2437959840105 748.9478816224358 341.0678632182793C749.1589384684868 340.8568063722284 749.1589384684868 340.8568063722284 749.3699953145377 340.6457495261774L865.6623174885921 224.3534273521231C887.4011726318367 202.8256290549296 887.4011726318367 180.6646602195834 865.8733743346432 158.2926345381865zM540.4237177241318 762.1262710898553C595.7206113894716 752.8397698636151 645.9521407495895 726.6687209533015 686.0529414992634 686.5679202036276S752.1137343132 596.2355900938359 761.6112923854912 540.9386964284961C763.9329176920513 527.0089445891356 775.9631579169534 517.3003296707935 789.6818529102629 517.3003296707935C791.3703076786703 517.3003296707935 792.8477056010266 517.5113865168444 794.536160369434 517.7224433628953C810.1543669772017 520.2551255155063 820.4961524336966 535.0291047390704 817.9634702810856 550.6473113468381C806.5664005943363 617.5523315449782 774.907873686699 678.5477600536929 726.5758559410393 726.8797777993525S617.2484096866651 806.8703224526494 550.343389488525 818.2673921393988C534.7251828807572 820.8000742920098 520.162260503244 810.4582888355148 517.4185215045821 795.0511390737981S524.8055111163642 764.6589532424663 540.4237177241318 762.1262710898553zM998.83918734672 558.8785283428238C980.0551280481886 669.0502019814016 928.1351439196632 769.3022038555864 848.3556561124173 849.0816916628324S668.3241664309865 980.7811635986036 558.1524927924087 999.565222897135C542.7453430306919 1002.308961895797 528.1824206531787 991.7561195932512 525.4386816545168 976.3489698315344C522.9059995019059 960.7307632237666 533.2477849584006 946.1678408462536 548.8659915661684 943.4241018475916C647.2184818258951 926.7506110095692 736.917641397534 880.107048032317 808.2548553627435 808.9808909131585C879.5920693279529 737.6436769479492 926.0245754591544 647.9445173763102 942.6980662971766 549.5920271165835C945.0196916037366 535.6622752772232 957.0499318286388 525.953660358881 970.7686268219484 525.953660358881C972.4570815903556 525.953660358881 973.934479512712 526.164717204932 975.6229342811195 526.3757740509828C991.0300840428362 528.697399357543 1001.582926345382 543.471378581107 998.83918734672 558.8785283428238z" /> diff --git a/demo/webfont.ttf b/demo/webfont.ttf index 6999ad07..f2681b7a 100644 Binary files a/demo/webfont.ttf and b/demo/webfont.ttf differ diff --git a/demo/webfont.woff b/demo/webfont.woff index e1e7ca9c..6c0cdbbb 100644 Binary files a/demo/webfont.woff and b/demo/webfont.woff differ diff --git a/demo/webfont.woff2 b/demo/webfont.woff2 index af6c0a23..d3ed8185 100644 Binary files a/demo/webfont.woff2 and b/demo/webfont.woff2 differ diff --git a/src/__tests__/__snapshots__/standalone.test.js.snap b/src/__tests__/__snapshots__/standalone.test.js.snap index 5088143d..d601f94c 100644 --- a/src/__tests__/__snapshots__/standalone.test.js.snap +++ b/src/__tests__/__snapshots__/standalone.test.js.snap @@ -6,7 +6,7 @@ exports[`standalone should create css selectors with transform titles through fu font-style: normal; font-weight: 400; font-display: auto; - src: url(\\"./webfont.eot\\"); + src: url(\\"./webfont.eot?test\\"); src: url(\\"./webfont.eot?#iefix\\") format(\\"embedded-opentype\\"); } @@ -125,8 +125,8 @@ exports[`standalone should generate all fonts with build-in template 1`] = ` font-style: normal; font-weight: 400; font-display: auto; - src: url(\\"./webfont.eot\\"); - src: url(\\"./webfont.eot?#iefix\\") format(\\"embedded-opentype\\"), url(\\"./webfont.woff2\\") format(\\"woff2\\"), url(\\"./webfont.woff\\") format(\\"woff\\"), url(\\"./webfont.ttf\\") format(\\"truetype\\"), url(\\"./webfont.svg#webfont\\") format(\\"svg\\"); + src: url(\\"./webfont.eot?test\\"); + src: url(\\"./webfont.eot?#iefix\\") format(\\"embedded-opentype\\"), url(\\"./webfont.woff2?test\\") format(\\"woff2\\"), url(\\"./webfont.woff?test\\") format(\\"woff\\"), url(\\"./webfont.ttf?test\\") format(\\"truetype\\"), url(\\"./webfont.svg?test#webfont\\") format(\\"svg\\"); } .webfont { @@ -242,13 +242,13 @@ exports[`standalone should generate all fonts with custom \`template\` with abso "/* custom template */ @font-face { font-family: webfont; - src: url(\\"./webfont.eot\\"); + src: url(\\"./webfont.eot?test\\"); src: url(\\"./webfont.eot?#iefix\\") format(\\"embedded-opentype\\"), - url(\\"./webfont.woff2\\") format(\\"woff2\\"), - url(\\"./webfont.woff\\") format(\\"woff\\"), - url(\\"./webfont.ttf\\") format(\\"truetype\\"), - url(\\"./webfont.svg#webfont\\") format(\\"svg\\"); + url(\\"./webfont.woff2?test\\") format(\\"woff2\\"), + url(\\"./webfont.woff?test\\") format(\\"woff\\"), + url(\\"./webfont.ttf?test\\") format(\\"truetype\\"), + url(\\"./webfont.svg?test#webfont\\") format(\\"svg\\"); font-style: normal; font-weight: 400; } @@ -308,13 +308,13 @@ exports[`standalone should generate all fonts with custom \`template\` with rela "/* custom template */ @font-face { font-family: webfont; - src: url(\\"./webfont.eot\\"); + src: url(\\"./webfont.eot?test\\"); src: url(\\"./webfont.eot?#iefix\\") format(\\"embedded-opentype\\"), - url(\\"./webfont.woff2\\") format(\\"woff2\\"), - url(\\"./webfont.woff\\") format(\\"woff\\"), - url(\\"./webfont.ttf\\") format(\\"truetype\\"), - url(\\"./webfont.svg#webfont\\") format(\\"svg\\"); + url(\\"./webfont.woff2?test\\") format(\\"woff2\\"), + url(\\"./webfont.woff?test\\") format(\\"woff\\"), + url(\\"./webfont.ttf?test\\") format(\\"truetype\\"), + url(\\"./webfont.svg?test#webfont\\") format(\\"svg\\"); font-style: normal; font-weight: 400; } @@ -377,7 +377,7 @@ exports[`standalone should generate only \`woff\` and \`woff2\` fonts with build font-weight: 400; font-display: auto; - src: url(\\"./webfont.woff2\\") format(\\"woff2\\"), url(\\"./webfont.woff\\") format(\\"woff\\"); + src: url(\\"./webfont.woff2?test\\") format(\\"woff2\\"), url(\\"./webfont.woff?test\\") format(\\"woff\\"); } .webfont { @@ -503,8 +503,8 @@ exports[`standalone should load config and respect \`template\` option with buil font-style: normal; font-weight: 400; font-display: auto; - src: url(\\"./webfont.eot\\"); - src: url(\\"./webfont.eot?#iefix\\") format(\\"embedded-opentype\\"), url(\\"./webfont.woff2\\") format(\\"woff2\\"), url(\\"./webfont.woff\\") format(\\"woff\\"), url(\\"./webfont.ttf\\") format(\\"truetype\\"), url(\\"./webfont.svg#webfont\\") format(\\"svg\\"); + src: url(\\"./webfont.eot?test\\"); + src: url(\\"./webfont.eot?#iefix\\") format(\\"embedded-opentype\\"), url(\\"./webfont.woff2?test\\") format(\\"woff2\\"), url(\\"./webfont.woff?test\\") format(\\"woff\\"), url(\\"./webfont.ttf?test\\") format(\\"truetype\\"), url(\\"./webfont.svg?test#webfont\\") format(\\"svg\\"); } %webfont { @@ -624,13 +624,13 @@ exports[`standalone should load config and respect \`template\` option with exte "/* custom template */ @font-face { font-family: webfont; - src: url(\\"./webfont.eot\\"); + src: url(\\"./webfont.eot?test\\"); src: url(\\"./webfont.eot?#iefix\\") format(\\"embedded-opentype\\"), - url(\\"./webfont.woff2\\") format(\\"woff2\\"), - url(\\"./webfont.woff\\") format(\\"woff\\"), - url(\\"./webfont.ttf\\") format(\\"truetype\\"), - url(\\"./webfont.svg#webfont\\") format(\\"svg\\"); + url(\\"./webfont.woff2?test\\") format(\\"woff2\\"), + url(\\"./webfont.woff?test\\") format(\\"woff\\"), + url(\\"./webfont.ttf?test\\") format(\\"truetype\\"), + url(\\"./webfont.svg?test#webfont\\") format(\\"svg\\"); font-style: normal; font-weight: 400; } @@ -692,8 +692,8 @@ exports[`standalone should respect \`template\` options 1`] = ` font-style: normal; font-weight: 400; font-display: auto; - src: url(\\"./foo-bar/bar.eot\\"); - src: url(\\"./foo-bar/bar.eot?#iefix\\") format(\\"embedded-opentype\\"), url(\\"./foo-bar/bar.woff2\\") format(\\"woff2\\"), url(\\"./foo-bar/bar.woff\\") format(\\"woff\\"), url(\\"./foo-bar/bar.ttf\\") format(\\"truetype\\"), url(\\"./foo-bar/bar.svg#bar\\") format(\\"svg\\"); + src: url(\\"./foo-bar/bar.eot?test\\"); + src: url(\\"./foo-bar/bar.eot?#iefix\\") format(\\"embedded-opentype\\"), url(\\"./foo-bar/bar.woff2?test\\") format(\\"woff2\\"), url(\\"./foo-bar/bar.woff?test\\") format(\\"woff\\"), url(\\"./foo-bar/bar.ttf?test\\") format(\\"truetype\\"), url(\\"./foo-bar/bar.svg?test#bar\\") format(\\"svg\\"); } .foo { diff --git a/src/__tests__/fixtures/configs/.webfontrc b/src/__tests__/fixtures/configs/.webfontrc index 561f41a1..1d27bdee 100644 --- a/src/__tests__/fixtures/configs/.webfontrc +++ b/src/__tests__/fixtures/configs/.webfontrc @@ -1,4 +1,5 @@ { "normalize": true, - "foo": "bar" + "foo": "bar", + "templateCacheString": "test" } diff --git a/src/__tests__/fixtures/configs/.webfontrc-with-build-in-template b/src/__tests__/fixtures/configs/.webfontrc-with-build-in-template index ef2bbe6e..93cfbba0 100644 --- a/src/__tests__/fixtures/configs/.webfontrc-with-build-in-template +++ b/src/__tests__/fixtures/configs/.webfontrc-with-build-in-template @@ -1,3 +1,4 @@ { - "template": "scss" + "template": "scss", + "templateCacheString": "test" } diff --git a/src/__tests__/fixtures/configs/.webfontrc-with-external-template b/src/__tests__/fixtures/configs/.webfontrc-with-external-template index 9a863f7f..f43b00f2 100644 --- a/src/__tests__/fixtures/configs/.webfontrc-with-external-template +++ b/src/__tests__/fixtures/configs/.webfontrc-with-external-template @@ -1,3 +1,4 @@ { - "template": "src/__tests__/fixtures/templates/template.css" + "template": "src/__tests__/fixtures/templates/template.css", + "templateCacheString": "test" } diff --git a/src/__tests__/fixtures/templates/template.css b/src/__tests__/fixtures/templates/template.css index 2902b028..95c5e3d9 100644 --- a/src/__tests__/fixtures/templates/template.css +++ b/src/__tests__/fixtures/templates/template.css @@ -1,13 +1,13 @@ /* custom template */ @font-face { font-family: {{ fontName }}; - {% if formats.indexOf('eot')>-1 %}src: url("{{ fontPath }}{{ fontName }}.eot");{% endif %} + {% if formats.indexOf('eot')>-1 %}src: url("{{ fontPath }}{{ fontName }}.eot?{{ cacheString }}");{% endif %} src: {% if formats.indexOf('eot')>-1 %}url("{{ fontPath }}{{ fontName }}.eot?#iefix") format("embedded-opentype"),{% endif %} - {% if formats.indexOf('woff2')>-1 %}url("{{ fontPath }}{{ fontName }}.woff2") format("woff2"),{% endif %} - {% if formats.indexOf('woff')>-1 %}url("{{ fontPath }}{{ fontName }}.woff") format("woff"),{% endif %} - {% if formats.indexOf('ttf')>-1 %}url("{{ fontPath }}{{ fontName }}.ttf") format("truetype"),{% endif %} - {% if formats.indexOf('svg')>-1 %}url("{{ fontPath }}{{ fontName }}.svg#{{ fontName }}") format("svg");{% endif %} + {% if formats.indexOf('woff2')>-1 %}url("{{ fontPath }}{{ fontName }}.woff2?{{ cacheString }}") format("woff2"),{% endif %} + {% if formats.indexOf('woff')>-1 %}url("{{ fontPath }}{{ fontName }}.woff?{{ cacheString }}") format("woff"),{% endif %} + {% if formats.indexOf('ttf')>-1 %}url("{{ fontPath }}{{ fontName }}.ttf?{{ cacheString }}") format("truetype"),{% endif %} + {% if formats.indexOf('svg')>-1 %}url("{{ fontPath }}{{ fontName }}.svg?{{ cacheString }}#{{ fontName }}") format("svg");{% endif %} font-style: normal; font-weight: 400; } diff --git a/src/__tests__/standalone.test.js b/src/__tests__/standalone.test.js index 50a50315..5b680db2 100644 --- a/src/__tests__/standalone.test.js +++ b/src/__tests__/standalone.test.js @@ -113,7 +113,8 @@ describe("standalone", () => { it("should generate all fonts with build-in template", async () => { const result = await standalone({ files: `${fixturesGlob}/svg-icons/**/*`, - template: "css" + template: "css", + templateCacheString: "test" }); expect(isSvg(result.svg)).toBe(true); @@ -128,7 +129,8 @@ describe("standalone", () => { const result = await standalone({ files: `${fixturesGlob}/svg-icons/**/*`, formats: ["woff", "woff2"], - template: "css" + template: "css", + templateCacheString: "test" }); expect(result.svg).toBeUndefined(); @@ -142,7 +144,8 @@ describe("standalone", () => { it("should generate all fonts with custom `template` with absolute path", async () => { const result = await standalone({ files: `${fixturesGlob}/svg-icons/**/*`, - template: path.join(fixturesGlob, "templates/template.css") + template: path.join(fixturesGlob, "templates/template.css"), + templateCacheString: "test" }); expect(isSvg(result.svg)).toBe(true); @@ -156,7 +159,8 @@ describe("standalone", () => { it("should generate all fonts with custom `template` with relative path", async () => { const result = await standalone({ files: `${fixturesGlob}/svg-icons/**/*`, - template: "src/__tests__/fixtures/templates/template.css" + template: "src/__tests__/fixtures/templates/template.css", + templateCacheString: "test" }); expect(isSvg(result.svg)).toBe(true); @@ -190,7 +194,8 @@ describe("standalone", () => { const result = await standalone({ configFile, - files: `${fixturesGlob}/svg-icons/**/*` + files: `${fixturesGlob}/svg-icons/**/*`, + templateCacheString: "test" }); expect(isSvg(result.svg)).toBe(true); @@ -332,7 +337,8 @@ describe("standalone", () => { return obj; }, - template: "css" + template: "css", + templateCacheString: "test" }); expect(result.template).toMatchSnapshot(); @@ -344,7 +350,8 @@ describe("standalone", () => { template: "css", templateClassName: "foo", templateFontName: "bar", - templateFontPath: "./foo-bar" + templateFontPath: "./foo-bar", + templateCacheString: "test" }); expect(isSvg(result.svg)).toBe(true); diff --git a/src/cli.js b/src/cli.js index 1a9601d1..2ac74a3b 100644 --- a/src/cli.js +++ b/src/cli.js @@ -70,6 +70,10 @@ const cli = meow( Font name in css template. + --template-cache-string + + Specify cache string in scss/css template. + --no-sort Keeps the files in the same order of entry @@ -215,6 +219,10 @@ const cli = meow( alias: "p", type: "string" }, + "template-cache-string": { + default: null, + type: "string" + }, verbose: { default: false, type: "boolean" @@ -269,6 +277,10 @@ if (cli.flags.templateFontName) { optionsBase.templateFontName = cli.flags.templateFontName; } +if (cli.flags.templateCacheString) { + optionsBase.templateCacheString = cli.flags.templateCacheString; +} + if (cli.flags.destTemplate) { optionsBase.destTemplate = cli.flags.destTemplate; } diff --git a/src/standalone.js b/src/standalone.js index aedb78a0..8ad6099c 100644 --- a/src/standalone.js +++ b/src/standalone.js @@ -98,7 +98,7 @@ function getGlyphsData(files, options) { return reject(error); } - metadata.unicode.push(metadata.name.replace("-", "_")); + metadata.unicode.push(metadata.name.replace(/-/g, "_")); glyphData.metadata = metadata; return resolve(glyphData); @@ -206,6 +206,7 @@ export default async function(initialOptions) { templateClassName: null, templateFontName: null, templateFontPath: "./", + templateCacheString: null, verbose: false }, initialOptions @@ -257,7 +258,8 @@ export default async function(initialOptions) { const buildInTemplates = { css: { path: path.join(templateDirectory, "template.css.njk") }, html: { path: path.join(templateDirectory, "template.html.njk") }, - scss: { path: path.join(templateDirectory, "template.scss.njk") } + scss: { path: path.join(templateDirectory, "template.scss.njk") }, + json: { path: path.join(templateDirectory, "template.json.njk") } }; let templateFilePath = null; @@ -292,7 +294,8 @@ export default async function(initialOptions) { { className: options.templateClassName || options.fontName, fontName: options.templateFontName || options.fontName, - fontPath: options.templateFontPath.replace(/\/?$/, "/") + fontPath: options.templateFontPath.replace(/\/?$/, "/"), + cacheString: options.templateCacheString || Date.now() } ]); diff --git a/templates/template.css.njk b/templates/template.css.njk index f2e2590e..93fc67aa 100644 --- a/templates/template.css.njk +++ b/templates/template.css.njk @@ -4,7 +4,7 @@ font-weight: 400; font-display: auto; {% if formats.indexOf('eot')>-1 -%} - src: url("{{ fontPath }}{{ fontName }}.eot"); + src: url("{{ fontPath }}{{ fontName }}.eot?{{ cacheString }}"); {%- endif %} {%- set eotIndex = formats.indexOf('eot') -%} {%- set woff2Index = formats.indexOf('woff2') -%} @@ -17,22 +17,22 @@ {%- if formats.length != 0 -%}, {% else -%}; {% endif -%} {%- endif -%} {%- if woff2Index != -1 -%} - url("{{ fontPath }}{{ fontName }}.woff2") format("woff2") + url("{{ fontPath }}{{ fontName }}.woff2?{{ cacheString }}") format("woff2") {%- set nothing = formats.splice(woff2Index, 1) -%} {%- if formats.length != 0 -%}, {% else -%}; {% endif -%} {%- endif -%} {%- if woffIndex != -1 -%} - url("{{ fontPath }}{{ fontName }}.woff") format("woff") + url("{{ fontPath }}{{ fontName }}.woff?{{ cacheString }}") format("woff") {%- set nothing = formats.splice(woffIndex, 1) -%} {%- if formats.length != 0 -%}, {% else -%}; {% endif -%} {%- endif -%} {%- if ttfIndex != -1 -%} - url("{{ fontPath }}{{ fontName }}.ttf") format("truetype") + url("{{ fontPath }}{{ fontName }}.ttf?{{ cacheString }}") format("truetype") {%- set nothing = formats.splice(ttfIndex, 1) -%} {%- if formats.length != 0 -%}, {% else -%}; {% endif -%} {%- endif -%} {%- if svgIndex != -1 -%} - url("{{ fontPath }}{{ fontName }}.svg#{{ fontName }}") format("svg"); + url("{{ fontPath }}{{ fontName }}.svg?{{ cacheString }}#{{ fontName }}") format("svg"); {%- endif %} } diff --git a/templates/template.html.njk b/templates/template.html.njk index 4298ca3f..93ce7b35 100644 --- a/templates/template.html.njk +++ b/templates/template.html.njk @@ -52,7 +52,7 @@ font-weight: 400; font-display: auto; {% if formats.indexOf('eot')>-1 -%} - src: url("{{ fontPath }}{{ fontName }}.eot"); + src: url("{{ fontPath }}{{ fontName }}.eot?{{ cacheString }}"); {%- endif %} {%- set eotIndex = formats.indexOf('eot') -%} {%- set woff2Index = formats.indexOf('woff2') -%} @@ -65,22 +65,22 @@ {%- if formats.length != 0 -%}, {% else -%}; {% endif -%} {%- endif -%} {%- if woff2Index != -1 -%} - url("{{ fontPath }}{{ fontName }}.woff2") format("woff2") + url("{{ fontPath }}{{ fontName }}.woff2?{{ cacheString }}") format("woff2") {%- set nothing = formats.splice(woff2Index, 1) -%} {%- if formats.length != 0 -%}, {% else -%}; {% endif -%} {%- endif -%} {%- if woffIndex != -1 -%} - url("{{ fontPath }}{{ fontName }}.woff") format("woff") + url("{{ fontPath }}{{ fontName }}.woff?{{ cacheString }}") format("woff") {%- set nothing = formats.splice(woffIndex, 1) -%} {%- if formats.length != 0 -%}, {% else -%}; {% endif -%} {%- endif -%} {%- if ttfIndex != -1 -%} - url("{{ fontPath }}{{ fontName }}.ttf") format("truetype") + url("{{ fontPath }}{{ fontName }}.ttf?{{ cacheString }}") format("truetype") {%- set nothing = formats.splice(ttfIndex, 1) -%} {%- if formats.length != 0 -%}, {% else -%}; {% endif -%} {%- endif -%} {%- if svgIndex != -1 -%} - url("{{ fontPath }}{{ fontName }}.svg#{{ fontName }}") format("svg"); + url("{{ fontPath }}{{ fontName }}.svg?{{ cacheString }}#{{ fontName }}") format("svg"); {%- endif %} } diff --git a/templates/template.json.njk b/templates/template.json.njk new file mode 100644 index 00000000..06f996f4 --- /dev/null +++ b/templates/template.json.njk @@ -0,0 +1,7 @@ +[ + {% for glyph in glyphs %}{ + "id": "{{ glyph.name }}", + "name": "{{ glyph.name | replace("-", " ") | title }}", + "unicode": [{% for unicode in glyph.unicode %}"{% if unicode | length != 1 %}{{unicode}}{% else %}{{ unicode.charCodeAt(0).toString(16)}}{% endif %}"{{ ', ' if glyph.unicode | last != unicode }}{% endfor %}] + }{{ ',' if glyphs | last != glyph }} +{% endfor %}] \ No newline at end of file diff --git a/templates/template.scss.njk b/templates/template.scss.njk index fa094d05..3289c7cb 100644 --- a/templates/template.scss.njk +++ b/templates/template.scss.njk @@ -8,7 +8,7 @@ font-weight: 400; font-display: auto; {% if formats.indexOf('eot')>-1 -%} - src: url("{{ fontPath }}{{ fontName }}.eot"); + src: url("{{ fontPath }}{{ fontName }}.eot?{{ cacheString }}"); {%- endif -%} {%- set eotIndex = formats.indexOf('eot') -%} {%- set woff2Index = formats.indexOf('woff2') -%} @@ -21,22 +21,22 @@ {%- if formats.length != 0 -%}, {% else -%}; {% endif -%} {%- endif -%} {%- if woff2Index != -1 -%} - url("{{ fontPath }}{{ fontName }}.woff2") format("woff2") + url("{{ fontPath }}{{ fontName }}.woff2?{{ cacheString }}") format("woff2") {%- set nothing = formats.splice(woff2Index, 1) -%} {%- if formats.length != 0 -%}, {% else -%}; {% endif -%} {%- endif -%} {%- if woffIndex != -1 -%} - url("{{ fontPath }}{{ fontName }}.woff") format("woff") + url("{{ fontPath }}{{ fontName }}.woff?{{ cacheString }}") format("woff") {%- set nothing = formats.splice(woffIndex, 1) -%} {%- if formats.length != 0 -%}, {% else -%}; {% endif -%} {%- endif -%} {%- if ttfIndex != -1 -%} - url("{{ fontPath }}{{ fontName }}.ttf") format("truetype") + url("{{ fontPath }}{{ fontName }}.ttf?{{ cacheString }}") format("truetype") {%- set nothing = formats.splice(ttfIndex, 1) -%} {%- if formats.length != 0 -%}, {% else -%}; {% endif -%} {%- endif -%} {%- if svgIndex != -1 -%} - url("{{ fontPath }}{{ fontName }}.svg#{{ fontName }}") format("svg"); + url("{{ fontPath }}{{ fontName }}.svg?{{ cacheString }}#{{ fontName }}") format("svg"); {%- endif %} }