From 9fff98b5f6167c446930d9e01c054e0ccac81ecd Mon Sep 17 00:00:00 2001 From: ful1e5 <24286590+ful1e5@users.noreply.github.com> Date: Mon, 25 Jan 2021 19:46:43 +0530 Subject: [PATCH] =?UTF-8?q?=F0=9F=9A=80=20Removed=20unuseful=20helpers?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/config.ts | 9 +-------- src/index.ts | 15 ++++----------- src/utils/htmlTemplate.ts | 4 ++-- 3 files changed, 7 insertions(+), 21 deletions(-) diff --git a/src/config.ts b/src/config.ts index 843b7b5..a69a14e 100644 --- a/src/config.ts +++ b/src/config.ts @@ -21,11 +21,4 @@ const animatedCursors = readdirSync(animatedCursorsDir).map((f) => resolve(animatedCursorsDir, f) ); -// Animated Config -const animatedClip = { - x: 4, - y: 4, - width: 200, - height: 200, -}; -export { staticCursors, animatedCursors, bitmapsDir, animatedClip }; +export { staticCursors, animatedCursors, bitmapsDir }; diff --git a/src/index.ts b/src/index.ts index 5007114..e0a20ab 100644 --- a/src/index.ts +++ b/src/index.ts @@ -2,13 +2,8 @@ import fs from "fs"; import path from "path"; import puppeteer from "puppeteer"; -import { generateRenderTemplate } from "./utils/htmlTemplate"; -import { - staticCursors, - bitmapsDir, - animatedCursors, - animatedClip, -} from "./config"; +import { htmlTemplate } from "./utils/htmlTemplate"; +import { staticCursors, bitmapsDir, animatedCursors } from "./config"; import { matchImages } from "./utils/matchImages"; import { saveFrames, Frames } from "./utils/saveFrames"; import { getFrameName } from "./utils/getFrameName"; @@ -32,7 +27,7 @@ const main = async () => { // Generating HTML Template const data = buffer.toString(); - const template = generateRenderTemplate(data); + const template = htmlTemplate(data); // config const bitmapName = `${path.basename(svgPath, ".svg")}.png`; @@ -58,7 +53,7 @@ const main = async () => { // Generating HTML Template const data = buffer.toString(); - const template = generateRenderTemplate(data); + const template = htmlTemplate(data); const page = await browser.newPage(); await page.setContent(template, { waitUntil: "networkidle2" }); @@ -80,7 +75,6 @@ const main = async () => { frames[firstKey] = { buffer: await svgElement.screenshot({ omitBackground: true, - clip: animatedClip, encoding: "binary", }), }; @@ -90,7 +84,6 @@ const main = async () => { while (!breakRendering) { const newFrame = await svgElement.screenshot({ omitBackground: true, - clip: animatedClip, encoding: "binary", }); const key = getFrameName(index, svgPath); diff --git a/src/utils/htmlTemplate.ts b/src/utils/htmlTemplate.ts index 05ea0cb..4224c27 100644 --- a/src/utils/htmlTemplate.ts +++ b/src/utils/htmlTemplate.ts @@ -4,7 +4,7 @@ export const template = `
-