mirror of
https://github.com/ryanoasis/nerd-fonts.git
synced 2024-09-19 09:51:48 +02:00
generate-css: Do not rely on external minimalizer
[why] The generated file `nerd-fonts-generated.css` is made smaller with an external service as manual step... # [Nerd Fonts] The following is generated from the build script, then through https://www.minifier.org/ We do not want any manual steps. [how] Luckily the difference is just to remove whitespaces and unneeded semicoli. We can do the same while generating. [note] At first I tried to postprocess the generated file with sed, but of course the strings that have blanks in them made that rather complicated. Signed-off-by: Fini Jastrow <ulf.fini.jastrow@desy.de>
This commit is contained in:
parent
61f59453f6
commit
41e0b16a4d
2 changed files with 17 additions and 4 deletions
1
bin/scripts/css-min-header.txt
Normal file
1
bin/scripts/css-min-header.txt
Normal file
|
@ -0,0 +1 @@
|
|||
@font-face{font-family:'NerdFontsSymbols Nerd Font';src:url("../fonts/NerdFontsSymbols-2048-em Nerd Font Complete.ttf") format("truetype");font-weight:normal;font-style:normal}.nf,.nerd-font,.nerd-fonts{font-family:'NerdFontsSymbols Nerd Font';speak:none;font-style:normal;font-weight:normal;font-variant:normal;text-transform:none;line-height:1;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;}
|
|
@ -7,7 +7,9 @@
|
|||
source ./lib/i_all.sh
|
||||
|
||||
output_css_file="../../css/nerd-fonts-generated.css"
|
||||
output_css_min_file="../../css/nerd-fonts-generated.min.css"
|
||||
header_css_file="./css-header.txt"
|
||||
header_css_min_file="./css-min-header.txt"
|
||||
if [ -d "../../temp" ]; then
|
||||
output_cheat_sheet_file="../../temp/nerd-fonts-generated-cheat-sheet.txt"
|
||||
text_gen=" and Cheat Sheet HTML"
|
||||
|
@ -19,6 +21,7 @@ version="2.2.2"
|
|||
|
||||
# clear files
|
||||
true > "$output_css_file" 2> /dev/null
|
||||
true > "$output_css_min_file" 2> /dev/null
|
||||
true > "$output_cheat_sheet_file" 2> /dev/null
|
||||
|
||||
# describe how the classes were established
|
||||
|
@ -28,11 +31,15 @@ true > "$output_cheat_sheet_file" 2> /dev/null
|
|||
printf " *%s Development Website: https://github.com/ryanoasis/nerd-fonts\\n" "$LINE_PREFIX"
|
||||
printf " *%s Version: %s\\n" "$LINE_PREFIX" "$version"
|
||||
printf " *%s The following is generated from the build script\\n" "$LINE_PREFIX"
|
||||
printf " */\\n\\n"
|
||||
# add top section of CSS
|
||||
cat $header_css_file
|
||||
} >> "$output_css_file"
|
||||
printf " */\\n"
|
||||
} | tee "$output_css_min_file" >> "$output_css_file"
|
||||
|
||||
# add top section of CSS
|
||||
{
|
||||
printf "\\n"
|
||||
cat "$header_css_file"
|
||||
} >> "$output_css_file"
|
||||
cat "$header_css_min_file" | tr -d '\n' >> "$output_css_min_file"
|
||||
|
||||
echo;
|
||||
|
||||
|
@ -63,6 +70,11 @@ for var in "${!i@}"; do
|
|||
printf "\\n"
|
||||
} >> "$output_css_file"
|
||||
|
||||
# generate css min rules
|
||||
{
|
||||
printf ".nf-%s:before{content:\"\\%s\"}" "$glyph_name" "$glyph_code"
|
||||
} >> "$output_css_min_file"
|
||||
|
||||
# generate HTML cheat sheet
|
||||
{
|
||||
printf "<div class=\"column\">"
|
||||
|
|
Loading…
Reference in a new issue