Image Optimization Script #348
Merged
a258wang
merged 45 commits from amy-image-optimization
into main
2 years ago
Loading…
Reference in new issue
There is no content yet.
Delete Branch 'amy-image-optimization'
Deleting a branch is permanent. It CANNOT be undone. Continue?
A build-time script to optimize images. Note that going forward, all images should be placed in
images
instead ofpublic/images
.Staging: https://csclub.uwaterloo.ca/~a3thakra/csc/amy-image-optimization/
Future improvements:
Image Optimization Scriptto WIP: Image Optimization Script 2 years agofddae28822
to609d10732c
2 years ago680d0a3d02
tob6cd0d3f35
2 years agoWIP: Image Optimization Scriptto Image Optimization Script 2 years agoI will revert that last commit before merging, after the PR has been approved.
Image Optimization Scriptto WIP: Image Optimization Script 2 years agoWIP: Image Optimization Scriptto Image Optimization Script 2 years agoThe pipeline issues and memory errors should be hopefully be fixed now. I will revert that last commit before merging, after the PR has been reviewed and approved.
const SOURCE_DIRECTORY = "images";
const DESTINATION_DIRECTORY = path.join("public", "images");
const TEAM_IMAGES_DIRECTORY = path.join("team", "");
isn't this supposed to be
path.join("images", "team")
getFilePathsInDirectory
returns the paths of the files relative to the given directory, so the Meet the Team images would have filepaths liketeam/AdityaThakral.jpg
. So the startsWith check on line 62 is checking to see if the filepath starts withteam/
.can you add that as a comment in code?
lgtm after you add that comment
"scripts": {
"dev": "next dev",
"build": "npm run build:web && npm run generate:calendar",
"dev": "npm run build:images && next dev",
Let's not do this everytime. Instead, if someone adds a new image, they should run this locally to see their image. You should also something about adding and optimizing images to the docs.
const imagePaths = await getFilePathsInDirectory(SOURCE_DIRECTORY);
await fse.emptyDir(DESTINATION_DIRECTORY);
const numberOfWorkers = Math.min(cpus().length, 8);
Can you leave a comment about the 8?
aae5c9adef
into main 2 years agoReviewers
aae5c9adef
.