@@ -36,7 +36,10 @@ function renderDocsAlertBox(content, tone = 'note', title = '') {
3636}
3737
3838// Skip slow optimizations when developing i.e. serve/watch or Netlify deploy preview
39- const DEV_MODE = process . env . ELEVENTY_RUN_MODE !== "build" || process . env . CONTEXT === "deploy-preview" || process . env . SKIP_IMAGES === 'true'
39+ const DEV_MODE = process . env . ELEVENTY_RUN_MODE !== "build" || process . env . CONTEXT === "deploy-preview"
40+ // Image processing is skipped in dev mode or when explicitly requested via SKIP_IMAGES.
41+ // Kept separate from DEV_MODE so build-time image flags never affect analytics/consent script inclusion.
42+ const SKIP_IMAGES = DEV_MODE || process . env . SKIP_IMAGES === 'true'
4043const DEPLOY_PREVIEW = process . env . CONTEXT === "deploy-preview" ;
4144const IMAGE_BUILD_PROFILE = process . env . IMAGE_BUILD_PROFILE || "full" ;
4245
@@ -1062,7 +1065,7 @@ module.exports = function(eleventyConfig) {
10621065
10631066 // Eleventy Image shortcode
10641067 // https://www.11ty.dev/docs/plugins/image/
1065- if ( DEV_MODE ) {
1068+ if ( SKIP_IMAGES ) {
10661069 console . info ( `[11ty] Image pipeline is enabled in dev mode, copying images without any conversion or resizing` )
10671070 } else {
10681071 console . info ( `[11ty] Image pipeline is enabled in prod mode, expect a wait for first build while images are converted and resized` )
@@ -1072,7 +1075,7 @@ module.exports = function(eleventyConfig) {
10721075 const title = null
10731076 const currentWorkingFilePath = this . page . inputPath
10741077
1075- return await imageHandler ( src , alt , title , widths , sizes , currentWorkingFilePath , eleventyConfig , async = true , DEV_MODE )
1078+ return await imageHandler ( src , alt , title , widths , sizes , currentWorkingFilePath , eleventyConfig , async = true , SKIP_IMAGES )
10761079 } ) ;
10771080
10781081 eleventyConfig . addAsyncShortcode ( "tileImage" , async function ( item , image , defaultImage , defaultDescription , imageSize , title = null , priority = false ) {
@@ -1094,7 +1097,7 @@ module.exports = function(eleventyConfig) {
10941097
10951098 const currentWorkingFilePath = this . page . inputPath ;
10961099
1097- return await imageHandler ( imageSrc , imageDescription , title , [ imageSize ] , null , currentWorkingFilePath , eleventyConfig , async = true , DEV_MODE , priority ) ;
1100+ return await imageHandler ( imageSrc , imageDescription , title , [ imageSize ] , null , currentWorkingFilePath , eleventyConfig , async = true , SKIP_IMAGES , priority ) ;
10981101 } ) ;
10991102
11001103 // Create a collection for sidebar navigation
@@ -1393,7 +1396,7 @@ module.exports = function(eleventyConfig) {
13931396 const async = false // cannot run async inside markdown
13941397
13951398 try {
1396- let imageHtml = imageHandler ( imgSrc , imgAlt , imgTitle , widths , htmlSizes , folderPath , eleventyConfig , async , DEV_MODE )
1399+ let imageHtml = imageHandler ( imgSrc , imgAlt , imgTitle , widths , htmlSizes , folderPath , eleventyConfig , async , SKIP_IMAGES )
13971400
13981401 // Add the additional attributes to the image
13991402 for ( let attr in attributes ) {
0 commit comments