-
Notifications
You must be signed in to change notification settings - Fork 46
375-workbook-images - Use custom generated images for workbooks #522
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
…wser to take a screenshot of HTML
|
Great stuff and interesting to hear that there's a successor to the the PhantomJS's of the 2010s with puppeteer. |
|
🎉for this work, @marshmallowrobot ❗️ I will take a look likely sometime next week. |
|
OK so you're generating images on-the-fly when building the website? Cool! It's neat that you figured out not only how to make the images but how to make it easy for the next person to do the same. I am thinking that it would be good to adjust so that the image is created once manually and then checked in to the repo. You can still check in the script for generating the image again if ever needed. Update Great work |
I would wonder how long it takes to regenerate the images in the GitHub action run? No really firm opinion here though.
Indeed! 🎉 |
Well, I wasn’t really thinking about the time involved but just having less moving parts during the build and then making it easy to see what the images look like when browsing the repo instead of needing to run a command in order to see what image will show up on the website. |
Fair points. I guess just knowing how the things needs to be called and what it depends upon is then what's needed. |
|
I took a little time to chew on this feedback. I like the idea of reducing complexity during site generation. There's already enough going on with translations. I think if we're going to go with static images, then I might kill off this PR entirely. It would be good enough to keep only the template HTML page. When the image needs to get updated, we could modify the HTML and take a literal screenshot of that page to create the static image we need. I'll close this PR for now without merging and resubmit a new PR with just the template and static images. |
|
Oh - sorry that some of the work wasn’t used, but this approach does strike me as simpler to maintain. Thank you for updating the image generation to be just HTML where it can be done in a web browser instead of the old way, which was some kind of image creation tool. |
Hey ya'll,
This PR introduces puppeteer to the code base. It is a headless browser that has a nifty screenshot function, which is used here to create images for the workbooks. All workbook-related functions have been moved to their own new module
workbook_generators.js. It has two public-facing functions:When
generate_learning_path_markdown.jsis run, TWO new directories are createdThe
workbooksfolder is created byimage.generate()function and contains all the workbook images together. Since it only contains images, it is copied to the website's/static/images/learn/*(instead of sharing/content/en/learn/*with contents ofnewsite).Please let me know your questions of feedbacks, I'm happy to make changes. TY!