mirror of
https://github.com/eth-p/bat-extras.git
synced 2025-06-20 19:57:46 +02:00
Updated documentation and added new prettybat formatter
This commit is contained in:
parent
5f248064e0
commit
0b04dfa5f4
@ -40,7 +40,8 @@ There are three different options for minification:
|
|||||||
| `--minify=lib` | Embedded library scripts will be minified. [default] |
|
| `--minify=lib` | Embedded library scripts will be minified. [default] |
|
||||||
| `--minify=all` | Everything will be minified. |
|
| `--minify=all` | Everything will be minified. |
|
||||||
|
|
||||||
This uses [bash_minifier](https://github.com/precious/bash_minifier) to perform minification, and requires Python 2 to be installed as either `python2` or `python`.
|
This uses [shfmt](https://github.com/mvdan/sh) to perform minification.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
18
build.sh
18
build.sh
@ -6,7 +6,6 @@
|
|||||||
# Issues: https://github.com/eth-p/bat-extras/issues
|
# Issues: https://github.com/eth-p/bat-extras/issues
|
||||||
# -----------------------------------------------------------------------------
|
# -----------------------------------------------------------------------------
|
||||||
HERE="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
HERE="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||||
DL="$HERE/.download"
|
|
||||||
BIN="$HERE/bin"
|
BIN="$HERE/bin"
|
||||||
SRC="$HERE/src"
|
SRC="$HERE/src"
|
||||||
LIB="$HERE/lib"
|
LIB="$HERE/lib"
|
||||||
@ -162,13 +161,7 @@ pp_strip_comments() {
|
|||||||
# Minify a Bash source file.
|
# Minify a Bash source file.
|
||||||
# https://github.com/precious/bash_minifier
|
# https://github.com/precious/bash_minifier
|
||||||
pp_minify() {
|
pp_minify() {
|
||||||
local python="python"
|
shfmt -mn
|
||||||
if command -v python2 &>/dev/null; then
|
|
||||||
python="python2"
|
|
||||||
fi
|
|
||||||
|
|
||||||
"$python" "$DL/minifier.py"
|
|
||||||
printf "\n"
|
|
||||||
}
|
}
|
||||||
|
|
||||||
# -----------------------------------------------------------------------------
|
# -----------------------------------------------------------------------------
|
||||||
@ -196,14 +189,13 @@ else
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
# -----------------------------------------------------------------------------
|
# -----------------------------------------------------------------------------
|
||||||
# Download resources.
|
# Check for resources.
|
||||||
|
|
||||||
[[ -d "$DL" ]] || mkdir "$DL"
|
|
||||||
[[ -d "$BIN" ]] || mkdir "$BIN"
|
[[ -d "$BIN" ]] || mkdir "$BIN"
|
||||||
|
|
||||||
if [[ "$OPT_MINIFY" != "none" ]] && ! [[ -f "$DL/minifier.py" ]]; then
|
if [[ "$OPT_MINIFY" != "none" ]] && ! command -v shfmt &>/dev/null; then
|
||||||
printc "%{YELLOW}Downloading %{BLUE}https://github.com/precious/bash_minifier%{YELLOW}...%{CLEAR}\n" 1>&2
|
printc "%{RED}Warning: cannot find shfmt. Unable to minify scripts.%{CLEAR}\n"
|
||||||
curl -sL "https://gitcdn.xyz/repo/precious/bash_minifier/master/minifier.py" > "$DL/minifier.py"
|
OPT_MINIFY=none
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# -----------------------------------------------------------------------------
|
# -----------------------------------------------------------------------------
|
||||||
|
@ -30,6 +30,7 @@ See `man bat` for more information.
|
|||||||
| YAML | [prettier](https://prettier.io/) |
|
| YAML | [prettier](https://prettier.io/) |
|
||||||
| HTML | [prettier](https://prettier.io/) |
|
| HTML | [prettier](https://prettier.io/) |
|
||||||
| Rust | [rustfmt](https://github.com/rust-lang/rustfmt) |
|
| Rust | [rustfmt](https://github.com/rust-lang/rustfmt) |
|
||||||
|
| Bash | [shfmt](https://github.com/mvdan/sh) |
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user