@apleasantview/eleventy-plugin-baseline 0.1.0-next.18 → 0.1.0-next.20
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/core/shortcodes/image.js +3 -1
- package/eleventy.config.js +13 -6
- package/package.json +1 -1
package/core/shortcodes/image.js
CHANGED
|
@@ -57,6 +57,8 @@ export async function imageShortcode(options = {}) {
|
|
|
57
57
|
setDimensions = true,
|
|
58
58
|
} = options;
|
|
59
59
|
|
|
60
|
+
const hasImageTransformPlugin = this.ctx._baseline.hasImageTransformPlugin;
|
|
61
|
+
|
|
60
62
|
if (!src) throw new Error("imageShortcode: src is required");
|
|
61
63
|
if (alt === undefined) {
|
|
62
64
|
throw new Error(
|
|
@@ -111,7 +113,7 @@ export async function imageShortcode(options = {}) {
|
|
|
111
113
|
style,
|
|
112
114
|
...(setDimensions ? { width: highsrc.width, height: highsrc.height } : {}),
|
|
113
115
|
...restAttrs,
|
|
114
|
-
"eleventy:ignore": true
|
|
116
|
+
...(hasImageTransformPlugin ? { "eleventy:ignore": true } : {})
|
|
115
117
|
};
|
|
116
118
|
|
|
117
119
|
const imgAttrString = Object.entries(imageAttributes)
|
package/eleventy.config.js
CHANGED
|
@@ -35,13 +35,16 @@ export default function baseline(options = {}) {
|
|
|
35
35
|
console.log(`[eleventy-plugin-baseline] WARN Eleventy plugin compatibility: ${e.message}`);
|
|
36
36
|
}
|
|
37
37
|
|
|
38
|
+
const hasImageTransformPlugin = eleventyConfig.hasPlugin("eleventyImageTransformPlugin");
|
|
39
|
+
|
|
38
40
|
const userOptions = {
|
|
39
41
|
version: version,
|
|
40
42
|
verbose: options.verbose ?? false,
|
|
41
43
|
enableNavigatorTemplate: options.enableNavigatorTemplate ?? false,
|
|
42
44
|
enableSitemapTemplate: options.enableSitemapTemplate ?? true,
|
|
43
45
|
multilingual: options.multilingual ?? false,
|
|
44
|
-
assetsESBuild: options.assetsESBuild ?? {},
|
|
46
|
+
assetsESBuild: options.assetsESBuild ?? { minify: true, target: "es2020" },
|
|
47
|
+
hasImageTransformPlugin,
|
|
45
48
|
...options
|
|
46
49
|
};
|
|
47
50
|
|
|
@@ -55,11 +58,15 @@ export default function baseline(options = {}) {
|
|
|
55
58
|
eleventyConfig.addGlobalData("_baseline", userOptions);
|
|
56
59
|
globals(eleventyConfig);
|
|
57
60
|
eleventyConfig.addPassthroughCopy({ "./src/static": "/" }, { failOnError: true });
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
61
|
+
|
|
62
|
+
// Prevents double-registering the preprocessor, user config wins.
|
|
63
|
+
if (!eleventyConfig.preprocessors.drafts) {
|
|
64
|
+
eleventyConfig.addPreprocessor("drafts", "*", (data, content) => {
|
|
65
|
+
if (data.draft && process.env.ELEVENTY_RUN_MODE === "build") {
|
|
66
|
+
return false;
|
|
67
|
+
}
|
|
68
|
+
});
|
|
69
|
+
}
|
|
63
70
|
|
|
64
71
|
if (isMultilingual) {
|
|
65
72
|
eleventyConfig.addPlugin(modules.multilangCore, {
|
package/package.json
CHANGED