@@ -734,6 +734,7 @@ const Plugin = () => {
734734 "theme" : "white" ,
735735 "highlight-theme" : "monokai" ,
736736 "favicon" : "/favicon.svg" ,
737+ "unocss" : "" ,
737738 // changed revealjs defaults
738739 "hash" : true ,
739740 } ;
@@ -756,23 +757,27 @@ const Plugin = () => {
756757 document . body . appendChild ( script ) ;
757758 } ;
758759 const loadTheme = ( name ) => async ( url ) => {
759- try {
760- let response = await fetch ( url ) ;
761- let json = await response . json ( ) ;
762- window . __unocss = {
763- ...window . __unocss ,
764- theme : {
765- ...( window . __unocss . theme || { } ) ,
766- ...json ,
767- } ,
768- } ;
769- } catch ( e ) {
770- console . error (
771- `An error occurred while fetching the unocss theme configuration, URL ${ url } :` ,
772- e ,
773- ) ;
760+ if ( url . length > 0 ) {
761+ console . debug ( "unocss: loading unocss theme from:" , url ) ;
762+ try {
763+ let response = await fetch ( url ) ;
764+ let json = await response . json ( ) ;
765+ window . __unocss = {
766+ ...window . __unocss ,
767+ theme : {
768+ ...( window . __unocss . theme || { } ) ,
769+ ...json ,
770+ } ,
771+ } ;
772+ } catch ( e ) {
773+ console . error (
774+ `unocss: An error occurred while fetching the unocss theme configuration, URL ${ url } :` ,
775+ e ,
776+ ) ;
777+ }
774778 }
775- await import ( "/vendor/unocss/core.global.js?url" ) ;
779+ await import ( "unocss" ) ;
780+ console . debug ( "unocss: finished loading unocss" ) ;
776781 } ;
777782 const addMeta = ( name ) => ( content ) => {
778783 const meta = document . createElement ( "meta" ) ;
@@ -910,11 +915,11 @@ const Plugin = () => {
910915 }
911916 const revealjsNewConfig = { } ;
912917 Object . keys ( mergedMetadata )
913- . map ( ( k ) => {
918+ . map ( async ( k ) => {
914919 const fn = applyFunctions [ k ] ;
915920 const value = mergedMetadata [ k ] ;
916921 if ( fn ) {
917- fn ( value ) ;
922+ await fn ( value ) ;
918923 } else {
919924 if ( k in revealjsConfig ) {
920925 revealjsNewConfig [ k ] = value ;
0 commit comments