nature-of-code / Nature-of-Code-Website-Archive

Repo for web files for nature of code
https://noc-processing-archive.netlify.app/
111 stars 21 forks source link

Adding support for new p5 sketches etc. #28

Closed nelliemckesson closed 6 years ago

nelliemckesson commented 6 years ago

Alriiight, so here's the corresponding code to go with the magicbook p5 iframe stuff. Some notes and questions:

<script type="text/javascript" src="https://natureofcode.com/book/javascripts/jquery.lazyloadxt.extra.min.js"></script>
<script type="text/javascript" src="https://natureofcode.com/book/javascripts/size-iframes.js"></script>

The first script is a lazy-loading library that will work with the iframes. The second is a custom js file I wrote to scale/resize two-col and three-col processing blocks (plus captions).

nelliemckesson commented 6 years ago

OH YEAH also during testing I noticed an error that the mathjax cdn shut down as of April 2017. We'll need to replace the header script tag to use the following (recommended by the mathjax folks):

<script type="text/javascript" async src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.1/MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script>
shiffman commented 6 years ago

Hey, this is awesome, thank you! Apologies if I'm confused, but I think what you are asking is where does all the other stuff (headers, navigation, etc.) come from when the book is generated? I don't think we have this set-up yet for HTML rendering with the new magic book system. Last time around it came from these "views" which were part of the Ruby build system.

https://github.com/shiffman/The-Nature-of-Code/tree/master/noc_html/views (@runemadsen could confirm, but I'm pretty sure that's it.)

I assume you created this pull request by manually adding the stuff here rather than generate from magic book and then bring over?

My ideal process would be to generate all the HTML pages in book/ via the magic book build at from Nature-of-Code and then just bulk copy the folder over here to publish.

The new design stuff in natureofcode2.0 was made manually and never integrated with the magic book build. As we've discussed I have no strong preference regarding using the new design vs. keeping the old vs. a combination / redesigns, etc.

Happy to jump on a call if easier to explain that way!

nelliemckesson commented 6 years ago

Aha, ok awesome, that answers most of my questions. Sounds like I should write a plugin to add all the header/footer stuff for the HTML build. Any reason you might want an HTML build without any of the extra website header stuff?

I think the best route is for me to write the plugins, etc, to get everything building correctly, but leave it up to you to copy files over to the site repo.

It looks like the javascripts should go here (correct?): https://github.com/shiffman/The-Nature-of-Code/tree/master/noc_html

I can't quite tell where the CSS is coming from. I see the generated html.css file in the build/assets/ folder, but it doesn't match what's currently in the website repo, which is a bit confusing.

Actually it might be a good idea to hop on a call real quick just to confirm which asset files I should be editing--I can do this evening or pretty much anytime tomorrow after noon EDT!

shiffman commented 6 years ago

I'll try to answer a bit here and then contact you via e-mail regarding a call.

I think the stylesheets are here?

https://github.com/shiffman/The-Nature-of-Code/tree/master/stylesheets

However, it's possible that there are some other CSS files that are a part of the natureofcode.com repo that somehow aren't part of The-Nature-of-Code build system.

And that's correct, the JS libraries used are in noc_html?

The way all this is organized is arbitrary and doesn't necessarily make any sense. This is likely a result of the project being completed at different times over a number of years by different people. A re-organization of files as well as removal of no longer used files would be welcome!

For example (and this is just one example), with the new way of integrating p5 sketches, the processingjs folder can be deleted.