Allow for html

This commit is contained in:
Michael Wolf
2020-05-25 07:53:11 -05:00
parent cf3493c9c5
commit 10ffb93f4e
3 changed files with 8 additions and 4 deletions

View File

@@ -15,6 +15,8 @@ function sniff_file_type () {
file_type="css"
elif [[ $ff == *.php ]] ; then
file_type="php"
elif [[ $ff == *.html ]] ; then
file_type="html"
fi
echo $file_type

View File

@@ -15,7 +15,8 @@ if [[ $file_type == "javascript" || \
$file_type == "vue" || \
$file_type == "css" || \
$file_type == "typescript" || \
$file_type == "php" ]] ; then
$file_type == "php" || \
$file_type == "html" ]] ; then
out=$(npx prettier --write $file)
retval="$?"
success_retval=0

View File

@@ -11,13 +11,12 @@ source "$DIR/_reformat-common.sh"
file_type=$(sniff_file_type $file)
retval=0
success_retval=0
if [[ $file_type == "javascript" || \
$file_type == "vue" || \
$file_type == "typescript" || \
$file_type == "css" || \
$file_type == "php" ]] ; then
$file_type == "php" || \
$file_type == "html" ]] ; then
out=$(npx prettier --check $file 2>&1 > /dev/null)
retval="$?"
success_retval=0
@@ -43,6 +42,8 @@ elif [[ x"$retval" == x"$would_reformat_retval" ]] ; then
exit 1
elif [[ x"$retval" == x"$syntax_error_retval" ]] ; then
echo -n "syntax error"
echo
echo "$out"
exit 2
else
echo -n "problem running reformatter"