@divriots/jampack 0.1.0 → 0.1.2
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/dist/compress.js +0 -1
- package/dist/optimize.js +2 -3
- package/package.json +2 -1
package/dist/compress.js
CHANGED
|
@@ -50,7 +50,6 @@ const addProgress = (r) => {
|
|
|
50
50
|
};
|
|
51
51
|
const printProgress = (r) => {
|
|
52
52
|
addProgress(r);
|
|
53
|
-
process.stdout.clearLine(0);
|
|
54
53
|
process.stdout.cursorTo(0);
|
|
55
54
|
process.stdout.write(`${state.total.nbFiles} files | ${formatBytes(state.total.dataLenUncompressed)} → ${formatBytes(state.total.dataLenCompressed)}`);
|
|
56
55
|
};
|
package/dist/optimize.js
CHANGED
|
@@ -6,6 +6,7 @@ import { isLocal, isNumeric, translateSrc } from './utils.js';
|
|
|
6
6
|
import sharp from "sharp";
|
|
7
7
|
import options from './options.js';
|
|
8
8
|
import { compressImage } from './compress.js';
|
|
9
|
+
import svgToMiniDataURI from 'mini-svg-data-uri';
|
|
9
10
|
const compressedImages = [];
|
|
10
11
|
const compressedResults = [];
|
|
11
12
|
async function analyse(dir, file) {
|
|
@@ -102,7 +103,7 @@ async function processImage(dir, file, $, imgElement) {
|
|
|
102
103
|
case 'svg':
|
|
103
104
|
const compressedData = await compressImage(originalData, {});
|
|
104
105
|
const svgEmbed = (compressedData && compressedData.length < originalData.length) ? compressedData : originalData;
|
|
105
|
-
datauri =
|
|
106
|
+
datauri = svgToMiniDataURI(svgEmbed.toString());
|
|
106
107
|
break;
|
|
107
108
|
case 'jpg':
|
|
108
109
|
case 'jpeg':
|
|
@@ -117,8 +118,6 @@ async function processImage(dir, file, $, imgElement) {
|
|
|
117
118
|
isEmbed = true;
|
|
118
119
|
img.removeAttr('loading');
|
|
119
120
|
img.removeAttr('decoding');
|
|
120
|
-
img.removeAttr('width');
|
|
121
|
-
img.removeAttr('height');
|
|
122
121
|
}
|
|
123
122
|
}
|
|
124
123
|
if (isEmbed) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@divriots/jampack",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.2",
|
|
4
4
|
"description": "Packer for static websites",
|
|
5
5
|
"author": "Georges Gomes @georges-gomes",
|
|
6
6
|
"bin": {
|
|
@@ -29,6 +29,7 @@
|
|
|
29
29
|
"csso": "^5.0.5",
|
|
30
30
|
"globby": "^13.1.2",
|
|
31
31
|
"html-minifier-terser": "^7.0.0",
|
|
32
|
+
"mini-svg-data-uri": "^1.4.4",
|
|
32
33
|
"sharp": "^0.31.0",
|
|
33
34
|
"svgo": "^2.8.0",
|
|
34
35
|
"table": "^6.8.0"
|