Generative Design Examples: Updated githack cdn to jsDelivr (#779)

* replaced () with {} to fix implicit return error

* added first version of fetching generative-design examples

* ignore local testing files

* formatting

* updated examples-gg-latest

* updated examples-gg-latest.js

- data files not served via rawgit - hallelujah!
- added jquery

* updated p5 version

* refactoring and code cleanup

* added comment

* comment out link to svgFiles - unused

* moved commented code

* fixed conflicts

* linted examples-gg-latest

* changed branch ref to master

* rm spaces

* updated url links with https for jquery and set branch to dev-updates for testing

* changed branched ref to master

* removed console.log of response.data to prevent logging user data to console

* fixed linting error

* updated p5 version from 0.7.1 to 0.7.2

* updated rawgit to jsdelivr cdn
This commit is contained in:
Joey Lee 2018-12-11 15:03:20 -05:00 committed by Cassie Tarakajian
parent 5bcb5119e3
commit 597a6637cb
2 changed files with 4761 additions and 4754 deletions

9499
package-lock.json generated

File diff suppressed because it is too large Load diff

View file

@ -27,7 +27,7 @@ const defaultHTML =
<!-- Generative Design Dependencies here --> <!-- Generative Design Dependencies here -->
<!-- GG Bundled --> <!-- GG Bundled -->
<script src="https://raw.githack.com/generative-design/Code-Package-p5.js/${branchName}/libraries/gg-dep-bundle/gg-dep-bundle.js"></script> <script src="https://cdn.jsdelivr.net/gh/generative-design/Code-Package-p5.js@${branchName}/libraries/gg-dep-bundle/gg-dep-bundle.js"></script>
<!-- Opentype --> <!-- Opentype -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/opentype.js/0.7.3/opentype.min.js"></script> <script src="https://cdnjs.cloudflare.com/ajax/libs/opentype.js/0.7.3/opentype.min.js"></script>
<!-- Rita --> <!-- Rita -->
@ -426,14 +426,14 @@ function getAllSketchContent(newProjectList) {
} }
if (newProject.files[i].url) { if (newProject.files[i].url) {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
console.log(sketchFile.name);
// https://cdn.rawgit.com/opensourcedesign/fonts/2f220059/gnu-freefont_freesans/FreeSans.otf?raw=true
// "https://raw.githubusercontent.com/generative-design/Code-Package-p5.js/gg4editor/01_P/P_3_2_1_01/data/FreeSans.otf", // "https://raw.githubusercontent.com/generative-design/Code-Package-p5.js/gg4editor/01_P/P_3_2_1_01/data/FreeSans.otf",
const rawGitRef = `https://raw.githack.com/${newProject.files[i].url.split('.com/')[1]}`; // https://cdn.jsdelivr.net/gh/generative-design/Code-Package-p5.js@master/01_P/P_4_3_1_01/data/pic.png
sketchFile.content = rawGitRef; // const rawGitRef = `https://raw.githack.com/${newProject.files[i].url.split('.com/')[1]}`;
sketchFile.url = rawGitRef; const cdnRef = `https://cdn.jsdelivr.net/gh/generative-design/Code-Package-p5.js@${branchName}${newProject.files[i].url.split(branchName)[1]}`
// https://raw.githack.com/generative-design/Code-Package-p5.js/master/libraries/gg-dep-bundle/gg-dep-bundle.js // console.log("🌈🌈🌈🌈🌈", sketchFile.name);
// replace ref in sketch.js ==> should serve from the file? // console.log("🌈🌈🌈🌈🌈", cdnRef);
sketchFile.content = cdnRef;
sketchFile.url = cdnRef;
// newProject.files[1].content = newProject.files[1].content.replace(`'data/${sketchFile.name}'`, `'${rawGitRef}'`); // newProject.files[1].content = newProject.files[1].content.replace(`'data/${sketchFile.name}'`, `'${rawGitRef}'`);
resolve(newProject); resolve(newProject);
}); });