mirror of
https://github.com/LukeHagar/website.git
synced 2025-12-10 04:22:18 +00:00
fix: style
This commit is contained in:
@@ -13,25 +13,25 @@ const config = {
|
||||
gif: { quality: 80 }
|
||||
};
|
||||
|
||||
function* walkSync(dir) {
|
||||
function* walk_directory(dir) {
|
||||
const files = readdirSync(dir);
|
||||
|
||||
for (const file of files) {
|
||||
const pathToFile = join(dir, file);
|
||||
const isDirectory = statSync(pathToFile).isDirectory();
|
||||
if (isDirectory) {
|
||||
yield* walkSync(pathToFile);
|
||||
yield* walk_directory(pathToFile);
|
||||
} else {
|
||||
yield pathToFile;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function isImage(file) {
|
||||
const imageExtensions = ["jpg", "jpeg", "png", "gif", "webp"];
|
||||
function is_image(file) {
|
||||
const image_extensions = ["jpg", "jpeg", "png", "gif", "webp"];
|
||||
const extension = file.split(".").pop().toLowerCase();
|
||||
|
||||
return imageExtensions.includes(extension);
|
||||
return image_extensions.includes(extension);
|
||||
}
|
||||
|
||||
function get_relative_path(file) {
|
||||
@@ -39,8 +39,8 @@ function get_relative_path(file) {
|
||||
}
|
||||
|
||||
async function main() {
|
||||
for (const file of walkSync(join(__dirname, '../static'))) {
|
||||
if (!isImage(file)) continue;
|
||||
for (const file of walk_directory(join(__dirname, '../static'))) {
|
||||
if (!is_image(file)) continue;
|
||||
console.log(get_relative_path(file));
|
||||
|
||||
const image = sharp(file);
|
||||
|
||||
Reference in New Issue
Block a user