File tree Expand file tree Collapse file tree 1 file changed +8
-1
lines changed Expand file tree Collapse file tree 1 file changed +8
-1
lines changed Original file line number Diff line number Diff line change @@ -78,9 +78,16 @@ async function fetchFileContent(item) {
7878 options . url !== ''
7979 ) {
8080 file . content = await rp ( options ) ;
81+
8182 // NOTE: remove the URL property if there's content
8283 // Otherwise the p5 editor will try to pull from that url
8384 if ( file . content !== null ) delete file . url ;
85+
86+ // Replace localhost references with references to the currently published version.
87+ file . content = file . content . replace (
88+ / h t t p : \/ \/ l o c a l h o s t ( : [ 0 - 9 ] + ) \/ m l 5 .j s / g,
89+ 'https://unpkg.com/ml5@latest/dist/ml5.min.js'
90+ ) ;
8491 }
8592
8693 return file ;
@@ -124,7 +131,7 @@ async function getCategoryExamples(sketchRootList) {
124131 // let options = Object.assign({url: `${requestOptions.url}/${categories.path}${branchRef}` }, requestOptions)
125132 const options = Object . assign ( { } , githubRequestOptions ) ;
126133 options . url = `${ options . url } ${ categories . path } ${ branchRef } ` ;
127- // console.log(options)
134+
128135 const sketchDirs = await rp ( options ) ;
129136
130137 try {
You can’t perform that action at this time.
0 commit comments