README: dependencies, a warning about pipes (cue Super Mario music)

parent e1a9784d
...@@ -5,19 +5,22 @@ A script to de-googlify CSS files, downloading relevant fonts in the process. Be ...@@ -5,19 +5,22 @@ A script to de-googlify CSS files, downloading relevant fonts in the process. Be
## Usage ## Usage
``` ```
./degooglify.sh [ https://fonts.googleapis.com/css?(...) | file.css ] ./degooglify.sh [ 'https://fonts.googleapis.com/css?(...)' | file.css ]
``` ```
**Please note: remember to put the URL in quotes, or otherwise escape any special characters.**
Google Fonts CSS URLs contain the pipe character (`|`) which will be interpreted by your shell and cause the URL passed to `degooglify.sh` to be incomplete.
## Operation ## 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. 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. 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: For relevant `@import` statements it will:
1. downloads the CSS files, saving them locally 1. download the CSS files, saving them locally
1. replaces the URL with the local file name generated based on the URL 1. replace the URL with the local file name generated based on the URL
1. degooglifies the downloaded file 1. degooglify the downloaded file
For relevant `src:` statements it: For relevant `src:` statements it:
1. downloads the font files into the `fonts/` subdirectory 1. downloads the font files into the `fonts/` subdirectory
...@@ -38,6 +41,16 @@ This is designed to give an informative file name, containing font families, sty ...@@ -38,6 +41,16 @@ This is designed to give an informative file name, containing font families, sty
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. 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.
## Dependencies
An attempt is made to keep dependencies down to as few as possible. Currently these are:
- Bash 3.x+
- either `curl` or `wget`
- GNU `sed` (or any other `sed` flavor that supports: `-i`, `-e`, `-E`)
- GNU `grep` (or any other `grep` flavor that supports extended regexen)
- `tr`
- standard system utilities (`cp`, `mkdir`)
## Bugs and feature requests ## Bugs and feature requests
Please send bug requests and feature reports to `tech(at)occrp.org`. Please send bug requests and feature reports to `tech(at)occrp.org`.
......
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