@divriots/jampack 0.23.3 → 0.23.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/LICENSE CHANGED
File without changes
package/README.md CHANGED
@@ -219,19 +219,14 @@ For more options see [CLI options](https://jampack.divriots.com/cli-options/).
219
219
 
220
220
  ## `jampack` used in the wild
221
221
 
222
- - [divRIOTS.com](https://divRIOTS.com)
223
- - [Backlight.dev](https://backlight.dev)
224
- - [story.to.design](https://story.to.design)
225
- - [html.to.design](https://html.to.design/docs)
226
- - [WebComponents.dev](https://WebComponents.dev)
227
- - [LWC.studio](https://lwc.studio)
228
- - [Components.studio](https://components.studio)
222
+ - Powering all [‹div›RIOTS](https://divRIOTS.com)' websites
229
223
  - [keycloak.ch](https://keycloak.ch)
230
224
  - [bayjs.org](https://bayjs.org/)
231
225
  - [qwind.pages.dev](https://qwind.pages.dev/)
232
226
  - [Bloycey's Blog](https://bloycey.blog/)
233
227
  - [gxanshu.in](https://gxanshu.in/)
234
-
228
+ - [cloudcannon.com](https://cloudcannon.com)
229
+ - [groupsync.app](https://groupsync.app)
235
230
  > Add yours here
236
231
 
237
232
  ## Why is it called `jampack`?
@@ -53,6 +53,7 @@ const default_options = {
53
53
  },
54
54
  svg: {
55
55
  optimization: true,
56
+ add_width_and_height: false,
56
57
  },
57
58
  },
58
59
  misc: {
@@ -53,6 +53,7 @@ export type Options = {
53
53
  };
54
54
  svg: {
55
55
  optimization: boolean;
56
+ add_width_and_height: boolean;
56
57
  };
57
58
  };
58
59
  misc: {
package/dist/index.js CHANGED
File without changes
package/dist/optimize.js CHANGED
@@ -650,6 +650,10 @@ async function setImageSize(htmlfile, img, image) {
650
650
  let height = img.attr('height');
651
651
  let width_new = undefined;
652
652
  let height_new = undefined;
653
+ const img_fmt = await image.getExt();
654
+ if (img_fmt === 'svg' && !config.image.svg.add_width_and_height) {
655
+ return [];
656
+ }
653
657
  // Check valid values
654
658
  if (width !== undefined) {
655
659
  if (!isNumeric(width)) {
@@ -696,7 +700,7 @@ async function setImageSize(htmlfile, img, image) {
696
700
  }
697
701
  else {
698
702
  // No width or height provided - set both to image size
699
- if ((await image.getExt()) === 'svg') {
703
+ if (img_fmt === 'svg') {
700
704
  // svg with no height and width has special sizing by browsers
701
705
  // They size it inside 300x150 unless they have width and height
702
706
  // attributes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@divriots/jampack",
3
- "version": "0.23.3",
3
+ "version": "0.23.4",
4
4
  "cache-version": {
5
5
  "img": "v1",
6
6
  "img-ext": "v1"
@@ -58,17 +58,18 @@
58
58
  "tslib": "^2.6.2",
59
59
  "typescript": "^5.3.3"
60
60
  },
61
- "engines": {
62
- "node": ">=14.0.0"
63
- },
64
- "bugs": "https://github.com/divriots/jampack/issues",
65
- "keywords": [],
66
- "types": "dist/index.d.ts",
67
61
  "scripts": {
68
62
  "watch": "pnpm build --watch",
69
63
  "try": "shx rm -fr demo && cp -R demo_drc demo && node ./dist/index.js ./demo --nocache",
70
64
  "build": "shx rm -rf dist && tsc -b",
71
65
  "lint": "eslint . --ext .ts --config .eslintrc",
66
+ "prepublishOnly": "pnpm build",
72
67
  "cleanAllDotJampack": "find -s . | grep '.jampack$' | xargs rm -fr"
73
- }
74
- }
68
+ },
69
+ "engines": {
70
+ "node": ">=14.0.0"
71
+ },
72
+ "bugs": "https://github.com/divriots/jampack/issues",
73
+ "keywords": [],
74
+ "types": "dist/index.d.ts"
75
+ }