@@ -362,6 +362,37 @@ const buildNewSVGIcons = function (done) {
362362 . pipe ( dest ( paths . version7 . outputVue ) ) ;
363363} ;
364364
365+ // ================================================================================
366+ // @@ FONTS CSS + JS ENTRY POINT
367+ // Extract @font -face declarations into a standalone CSS file and a JS entry
368+ // point so consumers can import '@dialpad/dialtone/fonts' via a bundler.
369+ // Webpack resolves the woff2 url() paths relative to dialtone-fonts.css in
370+ // dist/css/, which is where the font files live — no symlinks needed.
371+ // ================================================================================
372+ const libFontStyles = function ( done ) {
373+ if ( ! settings . styles ) return done ( ) ;
374+
375+ const fs = require ( 'fs' ) ;
376+ const css = fs . readFileSync ( './lib/dist/dialtone.css' , 'utf8' ) ;
377+
378+ const fontFaceBlocks = [ ] ;
379+ const regex = / @ f o n t - f a c e \s * \{ [ ^ } ] + \} / g;
380+ let match ;
381+ while ( ( match = regex . exec ( css ) ) !== null ) {
382+ fontFaceBlocks . push ( match [ 0 ] ) ;
383+ }
384+
385+ fs . writeFileSync ( './lib/dist/dialtone-fonts.css' , fontFaceBlocks . join ( '\n' ) + '\n' ) ;
386+ done ( ) ;
387+ } ;
388+
389+ const libFontsJS = function ( done ) {
390+ const fs = require ( 'fs' ) ;
391+ // eslint-disable-next-line quotes
392+ fs . writeFileSync ( './lib/dist/fonts.js' , "import './dialtone-fonts.css';\n" ) ;
393+ done ( ) ;
394+ } ;
395+
365396// ================================================================================
366397// @@ BUILD DOCS
367398// Process files and generate documentation
@@ -399,6 +430,8 @@ exports.default = series(
399430 exports . svg ,
400431 tokens ,
401432 libStyles ,
433+ libFontStyles ,
434+ libFontsJS ,
402435 libDocs ,
403436 libScripts ,
404437) ;
0 commit comments