Skip to content

Commit

Permalink
0.0.18
Browse files Browse the repository at this point in the history
  • Loading branch information
NikolaRHristov committed Aug 11, 2022
1 parent 6f42278 commit f8592a5
Show file tree
Hide file tree
Showing 6 changed files with 30 additions and 18 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 0.0.18

- Bug fix

## 0.0.17

- Refactor
Expand Down
2 changes: 1 addition & 1 deletion dist/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 5 additions & 5 deletions dist/options.d.ts → dist/options/index.d.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import CSS from "./options/css";
import HTML from "./options/html";
import IMG from "./options/img";
import JS from "./options/js";
import SVG from "./options/svg";
import CSS from "./css";
import HTML from "./html";
import IMG from "./img";
import JS from "./js";
import SVG from "./svg";
export default interface Options {
[key: string]: any;
/**
Expand Down
10 changes: 5 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "astro-compress",
"version": "0.0.17",
"version": "0.0.18",
"type": "module",
"description": "🗜️ AstroJS compression utilities. Compress HTML, CSS, JavaScript and more.",
"repository": {
Expand Down Expand Up @@ -28,7 +28,7 @@
"svg"
],
"scripts": {
"build": "esbuild --format=esm --platform=node --target=node14 --sources-content=false --minify --outdir=dist src/index.ts && tsc"
"build": "esbuild --format=esm --platform=node --target=node14 --minify --outdir=dist src/index.ts && tsc"
},
"dependencies": {
"csso": "5.0.5",
Expand All @@ -42,11 +42,11 @@
"devDependencies": {
"@types/csso": "5.0.0",
"@types/html-minifier-terser": "6.1.0",
"@types/node": "18.6.5",
"@types/node": "18.7.1",
"@types/sharp": "0.30.5",
"@types/svgo": "2.6.3",
"astro": "1.0.1",
"esbuild": "0.15.0",
"astro": "1.0.2",
"esbuild": "0.15.1",
"typescript": "4.7.4"
}
}
12 changes: 10 additions & 2 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ const formatBytes = async (bytes: number, decimals = 2) => {

return `${parseFloat((bytes / k ** i).toFixed(dm))} ${sizes[i]}`;
};

/**
* It takes a sharp file and an options object, and returns a buffer of the file in the format
* specified in the options object
Expand Down Expand Up @@ -144,7 +143,16 @@ const pipeAll = async (settings: Options, debug: number = 2) => {
`${settings.path}**/*.svg`,
debug,
files,
async (data) => svgo(data, setting)
async (data) => {
const result = svgo(data, setting);

if (typeof result.error !== "undefined") {
console.log(result.error);
} else {
// @ts-ignore
return result.data;
}
}
);
break;

Expand Down
10 changes: 5 additions & 5 deletions src/options.ts → src/options/index.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import CSS from "./options/css";
import HTML from "./options/html";
import IMG from "./options/img";
import JS from "./options/js";
import SVG from "./options/svg";
import CSS from "./css";
import HTML from "./html";
import IMG from "./img";
import JS from "./js";
import SVG from "./svg";

export default interface Options {
[key: string]: any;
Expand Down

0 comments on commit f8592a5

Please sign in to comment.