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) {
78
78
options . url !== ''
79
79
) {
80
80
file . content = await rp ( options ) ;
81
+
81
82
// NOTE: remove the URL property if there's content
82
83
// Otherwise the p5 editor will try to pull from that url
83
84
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
+ ) ;
84
91
}
85
92
86
93
return file ;
@@ -124,7 +131,7 @@ async function getCategoryExamples(sketchRootList) {
124
131
// let options = Object.assign({url: `${requestOptions.url}/${categories.path}${branchRef}` }, requestOptions)
125
132
const options = Object . assign ( { } , githubRequestOptions ) ;
126
133
options . url = `${ options . url } ${ categories . path } ${ branchRef } ` ;
127
- // console.log(options)
134
+
128
135
const sketchDirs = await rp ( options ) ;
129
136
130
137
try {
You can’t perform that action at this time.
0 commit comments