The Basic Guide to Run Squoosh Locally
Motive
Squoosh is released to the public under a free software license which is Apache License, Version 2.0. This means anybody can run, copy, distribute, study, change, and improve it. This also means I am allowed to change it and run it locally.
For privacy, I believe using Squoosh on a local machine is better than using it through squoosh.app. Although uBlock Origin can block Google Analytics, there is probably server logging or server-side tracking.
Prerequisite
I use Node version 18.18.0 and NPM version 10.5.2. If you use a different version, you may find a problem.
You need to understand about classes, functions, and variables in JavaScript.
Running Squoosh locally
First, download Squoosh source code from GitHub: GoogleChromeLabs/squoosh.
Then, run npm install. (I ignore all the npm audit commands.)
If you try running npm run build, you will get an error about colors.css. To fix this issue, follow the instructions on DEVTomatoCake's comment on "Error: Could not load css," issue number 1204, on GitHub.
Once you fix the issue, execute npm run build and npm run serve. Now, you should be able to run Squoosh locally.
Removing Google Analytics
Remove Google Analytics by following these steps:
- Turn off the local server.
- Open
src/client/initial-app/index.tsx. - Remove all the analytics code. (The analytics code is below the
main().) - Open
src/shared/prerendered-app/intro/index.tsx. - Search for
// Send the analytics datacomment. - Remove the
gaEventInfovariable and thegafunction. - Remove the rest of the
gafunctions and the associated variables. - Open
src/client/lazy-app/Compress/Results/index.tsx - Remove all the
gafunctions and the associated variables. - Remove
private onDownloadproperty. - Search for
onClick={this.onDownload}. - Remove the
onClickattribute.
Removing UTM parameters
Remove all the (Urchin Tracking Module) UTM parameters because they are useless. To do that, follow these steps:
- Open
src/static-build/index.tsx. - Remove all the UTM parameters. (Do not remove the forward slash. Just remove everything after it.)
Finishing
Run the local server. If you do not face any problems, great.
Now, you can run Squoosh in the proprietary operating system without being tracked by Google.
Share your thoughtsThank you for reading this The Basic Guide to Run Squoosh Locally. You can subscribe to all my articles with the Articles RSS. If you have a positive or negative comment, please send me an email or contact me through one of my social media accounts.
Share with your network
Copy this link and send it to great people only.
https://vanzasetia.xyz/blog/squoosh/
For you
Is There a Maximum Number for Media Queries?
This is a simple question you may ask, and the answer can be simple. But we will dive in and discuss this question to understand it and to hopefully get a solution.
By Vanza Setia
By Vanza Setia