data.gov
data.gov copied to clipboard
Performance lagging due to large css sourcemap
Lighthouse shows data.gov with a performance score of 62. The 10X team also uses 11ty for their site, and found that adjusting the CSS made for an improved performance.
How to reproduce
- Load data.gov
- Open Chrome dev tools
- Click Lighthouse tab
- Run Lighthouse report
Expected behavior
Faster load time of the page
Actual behavior
A slow load time of the page
Sketch
From the 10X person who messaged me:
Ok here are the changes for your group to try out:
-
package.json change the
assets:autoprefix
line to:"assets:autoprefix": "postcss _site/assets/styles/*.css -r",
-
and postcss.config.js
module.exports = {
plugins: [require('autoprefixer')({
map: process.env.ELEVENTY_ENV !== 'production'
})],
};
- in the
config/buildAssets.js
this seemed to help our build too, adding this line to the esbuild.build array
minifyWhitespace: true,
Note: this work has been partially completed in https://github.com/GSA/datagov-11ty/pull/276