Image Optimization Script #348
Labels
No Label
a11y
Backlog
Blocked
Bug
Content
Dependencies
Design
Feature Request
Good First Issue
In Progress
Performance
Priority - High
Priority - Low
Priority - Medium
Untriaged
No Milestone
No project
No Assignees
3 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: www/www-new#348
Loading…
Reference in New Issue
No description provided.
Delete Branch "amy-image-optimization"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. 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 Scriptfddae28822
to609d10732c
680d0a3d02
tob6cd0d3f35
WIP: Image Optimization Scriptto Image Optimization ScriptI will revert that last commit before merging, after the PR has been approved.
Image Optimization Scriptto WIP: Image Optimization ScriptWIP: Image Optimization Scriptto Image Optimization ScriptThe 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.
@ -0,0 +16,4 @@
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
@ -8,3 +8,2 @@
"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.
@ -0,0 +37,4 @@
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?