@divriots/jampack 0.11.1 → 0.11.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/config-default.js +3 -0
- package/dist/config-types.d.ts +3 -0
- package/dist/optimize.js +16 -7
- package/package.json +1 -1
package/dist/config-default.js
CHANGED
package/dist/config-types.d.ts
CHANGED
package/dist/optimize.js
CHANGED
|
@@ -79,13 +79,15 @@ async function analyse(file) {
|
|
|
79
79
|
$('the-fold').remove();
|
|
80
80
|
}
|
|
81
81
|
// Add CSS to head
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
heads.
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
82
|
+
if (config.html.add_css_reset_as === 'inline') {
|
|
83
|
+
const CSS = `<style>:where(img){height:auto;width:auto}</style>`;
|
|
84
|
+
const heads = $('head');
|
|
85
|
+
if (heads.length > 0) {
|
|
86
|
+
heads.prepend(CSS);
|
|
87
|
+
}
|
|
88
|
+
else {
|
|
89
|
+
(_a = $('html')) === null || _a === void 0 ? void 0 : _a.prepend(`<head>${CSS}</head>`);
|
|
90
|
+
}
|
|
89
91
|
}
|
|
90
92
|
if (!$state.args.nowrite) {
|
|
91
93
|
await fs.writeFile(path.join($state.dir, file), $.html());
|
|
@@ -122,6 +124,13 @@ async function processImage(htmlfile, $, imgElement, isAboveTheFold) {
|
|
|
122
124
|
*/
|
|
123
125
|
const attrib_src = img.attr('src');
|
|
124
126
|
if (!attrib_src) {
|
|
127
|
+
const attrib_data_src = img.attr('data-src');
|
|
128
|
+
if (attrib_data_src) {
|
|
129
|
+
// Contains attribute [data-src]
|
|
130
|
+
// Most likely, this is a Javascript lazy-loaded image
|
|
131
|
+
// Let's not mess with it and hope it's well done
|
|
132
|
+
return; // No warnings
|
|
133
|
+
}
|
|
125
134
|
$state.reportIssue(htmlfile, {
|
|
126
135
|
type: 'warn',
|
|
127
136
|
msg: `Missing [src] on img - processing skipped.`,
|