README.md more or less complete

parent 93f2cef3
# Fonts Degooglifier
A script to de-googlify CSS files, downloading relevant fonts in the process. Because privacy matters and self-hosting is a thing.
## Usage
```
./degooglify.sh [ https://fonts.googleapis.com/css?(...) | file.css ]
```
## Operation
The `degooglify.sh` script takes as arguments local files and URLs (leading to `fonts.googleapis.com`). It handles multiple arguments, including mixing of URLs and files.
It then downloads the CSS files from URLs provided, and in all local and downloaded files looks for `@import` (with URL pointing to `fonts.googleapis.com`) and `src:` (with URL pointing to `fonts.gstatic.com`) statements.
For relevant `@import` statements it then:
1. downloads the CSS files, saving them locally
1. replaces the URL with the local file name generated based on the URL
1. degooglifies the downloaded file
For relevant `src:` statements it:
1. downloads the font files into the `fonts/` subdirectory
1. replaces the URLs with downloaded font files' locations
Original files are never modified. Instead, copies are created with `.degooglified` added to the name right before the `.css` extension.
## Filenames of downloaded resources
For CSS URLs, the file names of downloaded files are generated by:
1. dropping the `https://fonts.googleapis.com/css?family=` part
1. replacing all occurences of `&` and `&` with `__`
1. replacing all occurences of `|` with `_`
1. replacing all occurences of any of `:+,=` with `-`
1. adding `.degooglified` before the final `.css`
This is designed to give an informative file name, containing font families, styles, and information on scripts included, based on the information available in the original CSS URL.
For font URLs, the file names of downloaded files are generated by taking the font name from `local()` stanza in the `src:` statement, and adding the extension taken from the URL.
## Bugs and feature requests
Please send bug requests and feature reports to `tech(at)occrp.org`.
## License
GNU Affero General Public License, version 3.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment