An Informal Survey of Web Performance Tooling in 2021
What tools are web performance engineers using to measure site speed in 2021?
Add Prettier with a pre-commit hook and dedicate one commit to a full reformat
While working at a smaller dev shop, our team hit the point at which the inconsistent code formats between and within projects was becoming a pain. Our needs included:
We decided to go with Prettier. We also added a pre-commit hook to ensure that all code changes complied with the new authoritarianism.
I initially published this as a gist to help when setting up new projects at that company. Today, it was useful for a client I was working with, so I'm sharing it now in an article in case the same use case fits for you, and you'd like a handy reference.
Most of these steps can be found in the docs and through other links in the docs.
$ npm install --save-dev --save-exact prettier
$ echo {}> .prettierrc.json
.prettierignore
file to let tools know which files NOT to format. node_modules
are ignored by default. Some suggestions:build
coverage
.package-lock.json
*.min.*
$ npx prettier --write .
$ npm i --save-dev pretty-quick husky
package.json
file:"husky": {
"hooks": {
"pre-commit": "pretty-quick --staged"
}
},
Now when you commit your changes, files in the commit will automatically be formatted!
I'm a freelance performance engineer and web developer, and I'm available for your projects.
Hire meWhat tools are web performance engineers using to measure site speed in 2021?
Discover all JavaScript downloaded for a site and used vs unused in a handy data visualization.
Get started going serverless with Netlify functions and Netlify-CLI for keeping secrets secret
If you liked this article and think others should read it, please share it.
These are webmentions via the IndieWeb and webmention.io. Mention this post from your site: