@divriots/jampack 0.1.7 → 0.1.8

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.
Files changed (2) hide show
  1. package/dist/optimize.js +18 -10
  2. package/package.json +1 -1
package/dist/optimize.js CHANGED
@@ -124,14 +124,6 @@ async function processImage(file, $, imgElement) {
124
124
  return;
125
125
  }
126
126
  /*
127
- * Attribute 'width' & 'height'
128
- */
129
- const [w, h] = setImageSize(img, meta);
130
- if (w < 0 || h < 0) {
131
- console.warn(`Unexpected error in image size calculation - some optimizations can't be done`);
132
- return;
133
- }
134
- /*
135
127
  * Compress image
136
128
  */
137
129
  if (!globalState.compressedFiles.has(absoluteImgPath)) {
@@ -150,11 +142,27 @@ async function processImage(file, $, imgElement) {
150
142
  }
151
143
  globalState.addFile(result);
152
144
  }
145
+ //
146
+ // Stop here if svg
147
+ //
148
+ if (meta.format === 'svg')
149
+ return;
150
+ /*
151
+ * Attribute 'width' & 'height'
152
+ */
153
+ const [w, h] = setImageSize(img, meta);
154
+ if (w < 0 || h < 0) {
155
+ console.warn(`Unexpected error in image size calculation - some optimizations can't be done`);
156
+ return;
157
+ }
158
+ /*
159
+ * Attribute 'srcset'
160
+ */
153
161
  const attr_srcset = img.attr('srcset');
154
162
  if (attr_srcset) {
155
163
  // If srcset is set, don't touch it.
156
- // Just compress files
157
- // TODO
164
+ // The compress pass will compress the images
165
+ // of the srcset
158
166
  }
159
167
  else {
160
168
  // Generate image set
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@divriots/jampack",
3
- "version": "0.1.7",
3
+ "version": "0.1.8",
4
4
  "description": "Packer for static websites",
5
5
  "author": "Georges Gomes @georges-gomes",
6
6
  "bin": {