Skip to content

Commit 04528dd

Browse files
committed
Enable optimization for staging too
1 parent 93c8d2d commit 04528dd

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

eleventy.config.js

+3-2
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ import {eleventyImageTransformPlugin} from '@11ty/eleventy-img';
2828
*/
2929
export default function (eleventyConfig) {
3030
const isProduction = process.env.PRODUCTION === 'true';
31+
const shouldOptimize = process.env.OPTIMIZE === 'true';
3132

3233
eleventyConfig.on('eleventy.before', async () => {
3334
await configureHighlighting(markdown);
@@ -72,7 +73,7 @@ export default function (eleventyConfig) {
7273
}
7374

7475
const result = sass.compileString(inputContent, {
75-
style: isProduction ? 'compressed' : 'expanded',
76+
style: shouldOptimize ? 'compressed' : 'expanded',
7677
quietDeps: true,
7778
loadPaths: [parsedPath.dir, 'src/_sass'],
7879
});
@@ -104,7 +105,7 @@ export default function (eleventyConfig) {
104105
'src/content/guides/language/specifications',
105106
);
106107

107-
if (isProduction) {
108+
if (shouldOptimize) {
108109
// If building for production, minify/optimize the HTML output.
109110
// Doing so during serving isn't worth the extra build time.
110111
eleventyConfig.addTransform('minify-html', async function (content) {

package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@
1010
},
1111
"scripts": {
1212
"serve": "PRODUCTION=false eleventy --serve",
13-
"build-site-for-staging": "PRODUCTION=false eleventy",
14-
"build-site-for-production": "PRODUCTION=true eleventy"
13+
"build-site-for-staging": "PRODUCTION=false OPTIMIZE=true eleventy",
14+
"build-site-for-production": "PRODUCTION=true OPTIMIZE=true eleventy"
1515
},
1616
"engines": {
1717
"node": ">=20.10.0",

0 commit comments

Comments
 (0)