diff --git a/.gitignore b/.gitignore index eef98e69a..e9bb29422 100644 --- a/.gitignore +++ b/.gitignore @@ -13,3 +13,5 @@ package-lock.json *.uuid bin/scripts/name_parser/__pycache__/* bin/scripts/name_parser/log +# This is just needed for the cheat sheet and not go into the repo: +css/nerd-fonts-generated-removed.min.css diff --git a/bin/scripts/data/cheatsheet-foot.txt b/bin/scripts/data/cheatsheet-foot.txt index 8e4c1d0ff..4d2212436 100644 --- a/bin/scripts/data/cheatsheet-foot.txt +++ b/bin/scripts/data/cheatsheet-foot.txt @@ -1,4 +1,9 @@ +

Removed Icons

+
With Release v3.0.0 the Material Design Icons were updated and moved to new codepoints (reasons for that are in the release notes).
+
They are still shown here for reference, but are missing in the actual fonts.
+
To find for example the replacement for nf-mdi-altimeter enter just altimeter in the search box.
+

Example Usages

diff --git a/bin/scripts/data/css-min-removed-header.txt b/bin/scripts/data/css-min-removed-header.txt new file mode 100644 index 000000000..766ef94c4 --- /dev/null +++ b/bin/scripts/data/css-min-removed-header.txt @@ -0,0 +1 @@ +@font-face{font-family:'V233Symbols';src:url("../fonts/Symbols-2048-em Nerd Font Complete v233.woff2") format("woff2");font-weight:normal;font-style:normal}.nfold,.nerd-font,.nerd-fonts{font-family:'V233Symbols';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;} diff --git a/bin/scripts/generate-css.sh b/bin/scripts/generate-css.sh index 3bd3fc0fe..1167d8533 100755 --- a/bin/scripts/generate-css.sh +++ b/bin/scripts/generate-css.sh @@ -4,12 +4,14 @@ # Generates CSS file for the font and cheat sheet code # shellcheck disable=SC1091 -source ./lib/i_all.sh +source ./lib/i_all.sh include-old-material output_css_file="../../css/nerd-fonts-generated.css" output_css_min_file="../../css/nerd-fonts-generated.min.css" +output_css_min_rem_file="../../css/nerd-fonts-generated-removed.min.css" header_css_file="./data/css-header.txt" header_css_min_file="./data/css-min-header.txt" +header_css_min_rem_file="./data/css-min-removed-header.txt" output_json_file="../../glyphnames.json" if [ ! -d "../../temp" ]; then @@ -25,6 +27,7 @@ version="3.0.0" # clear files true > "$output_css_file" 2> /dev/null true > "$output_css_min_file" 2> /dev/null +true > "$output_css_min_rem_file" 2> /dev/null true > "$output_cheat_sheet_file" 2> /dev/null true > "$output_json_file" 2> /dev/null @@ -36,7 +39,7 @@ true > "$output_json_file" 2> /dev/null printf " *%s Version: %s\\n" "$LINE_PREFIX" "$version" printf " *%s The following is generated from the build script\\n" "$LINE_PREFIX" printf " */\\n" -} | tee "$output_css_min_file" >> "$output_css_file" +} | tee "$output_css_min_file" | tee "$output_css_min_rem_file" >> "$output_css_file" # add top section of CSS { @@ -44,6 +47,7 @@ true > "$output_json_file" 2> /dev/null cat "$header_css_file" } >> "$output_css_file" cat "$header_css_min_file" | tr -d '\n' >> "$output_css_min_file" +cat "$header_css_min_rem_file" | tr -d '\n' >> "$output_css_min_rem_file" cat "$cheat_sheet_head_file" > "$output_cheat_sheet_file" @@ -76,29 +80,44 @@ for var in "${!i@}"; do #echo "$glyph_code" #printf "%x" "'$glyph_char'" - # generate css rules - { - printf ".nf-%s:before {" "$glyph_name" - printf "\\n" - printf " content: \"\\%s\";" "$glyph_code" - printf "\\n" - printf "}" - printf "\\n" - } >> "$output_css_file" + if [[ "$glyph_name" != mdi-* ]]; then + # generate css rules + { + printf ".nf-%s:before {" "$glyph_name" + printf "\\n" + printf " content: \"\\%s\";" "$glyph_code" + printf "\\n" + printf "}" + printf "\\n" + } >> "$output_css_file" - # generate css min rules - { - printf ".nf-%s:before{content:\"\\%s\"}" "$glyph_name" "$glyph_code" - } >> "$output_css_min_file" + # generate css min rules + { + printf ".nf-%s:before{content:\"\\%s\"}" "$glyph_name" "$glyph_code" + } >> "$output_css_min_file" + + # generate json entry + { + printf ",\"%s\":{\"char\":\"%s\",\"code\":\"%s\"}" "$glyph_name" "$glyph_char" "$glyph_code" + } >> "$output_json_file" + + else + # generate css min rules for removed glyphs + { + printf ".nfold-%s:before{content:\"\\%s\"}" "$glyph_name" "$glyph_code" + } >> "$output_css_min_rem_file" + fi # generate HTML cheat sheet { printf "
" printf "\\n" if [[ "$glyph_name" = mdi-* ]]; then - printf " obsolete\\n" + printf " removed\\n" + printf "
" "$glyph_name" + else + printf "
" "$glyph_name" fi - printf "
" "$glyph_name" printf "\\n" printf "
nf-%s
%s
" "$glyph_name" "$glyph_code" printf "\\n" @@ -106,14 +125,14 @@ for var in "${!i@}"; do printf "\\n" } >> "$output_cheat_sheet_file" - # generate json entry - { - printf ",\"%s\":{\"char\":\"%s\",\"code\":\"%s\"}" "$glyph_name" "$glyph_char" "$glyph_code" - } >> "$output_json_file" - done cat "$cheat_sheet_foot_file" >> "$output_cheat_sheet_file" printf "}\n" >> "$output_json_file" printf "Generated CSS, json, and Cheat Sheet HTML\\n" +printf "$output_css_file\n" +printf "$output_css_min_file [needs to also go into gh-pages:_includes/css/]\n" +printf "$output_css_min_rem_file [needs to only go into gh-pages:_includes/css/]\n" +printf "$output_cheat_sheet_file [needs to only go into gh-pages:_posts/]\n" +printf "$output_json_file\n" diff --git a/bin/scripts/lib/i_all.sh b/bin/scripts/lib/i_all.sh index 81e480dc2..857c12aed 100644 --- a/bin/scripts/lib/i_all.sh +++ b/bin/scripts/lib/i_all.sh @@ -1,9 +1,20 @@ #!/usr/bin/env bash # Nerd Fonts Version: 3.0.0 -# Script Version 1.1.0 +# Script Version 1.2.0 -for i in $(dirname "${BASH_SOURCE[0]:-$0}")/i_{cod,dev,fae,fa,iec,logos,oct,ple,pom,seti,material,weather,md}.sh; do - # shellcheck source=/dev/null +# Usually this is called without argument. If the first argument +# is 'include-old-material' the old material design icons will be +# included. This is needed for the cheat sheet. + +sets=('cod' 'dev' 'fae' 'fa' 'iec' 'logos' 'oct' 'ple' 'pom' 'seti' 'weather' 'md') +base=$(dirname "${BASH_SOURCE[0]:-$0}") + +if [ "$1" = "include-old-material" ]; then + sets=(${sets[@]} 'material') +fi + +for set in ${sets[@]}; do + i="${base}/i_${set}.sh" test -f "$i" -a -r "$i" && source "$i" done unset i