Allow for html
This commit is contained in:
@@ -15,6 +15,8 @@ function sniff_file_type () {
|
|||||||
file_type="css"
|
file_type="css"
|
||||||
elif [[ $ff == *.php ]] ; then
|
elif [[ $ff == *.php ]] ; then
|
||||||
file_type="php"
|
file_type="php"
|
||||||
|
elif [[ $ff == *.html ]] ; then
|
||||||
|
file_type="html"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo $file_type
|
echo $file_type
|
||||||
|
|||||||
@@ -15,7 +15,8 @@ if [[ $file_type == "javascript" || \
|
|||||||
$file_type == "vue" || \
|
$file_type == "vue" || \
|
||||||
$file_type == "css" || \
|
$file_type == "css" || \
|
||||||
$file_type == "typescript" || \
|
$file_type == "typescript" || \
|
||||||
$file_type == "php" ]] ; then
|
$file_type == "php" || \
|
||||||
|
$file_type == "html" ]] ; then
|
||||||
out=$(npx prettier --write $file)
|
out=$(npx prettier --write $file)
|
||||||
retval="$?"
|
retval="$?"
|
||||||
success_retval=0
|
success_retval=0
|
||||||
|
|||||||
@@ -11,13 +11,12 @@ source "$DIR/_reformat-common.sh"
|
|||||||
|
|
||||||
file_type=$(sniff_file_type $file)
|
file_type=$(sniff_file_type $file)
|
||||||
|
|
||||||
retval=0
|
|
||||||
success_retval=0
|
|
||||||
if [[ $file_type == "javascript" || \
|
if [[ $file_type == "javascript" || \
|
||||||
$file_type == "vue" || \
|
$file_type == "vue" || \
|
||||||
$file_type == "typescript" || \
|
$file_type == "typescript" || \
|
||||||
$file_type == "css" || \
|
$file_type == "css" || \
|
||||||
$file_type == "php" ]] ; then
|
$file_type == "php" || \
|
||||||
|
$file_type == "html" ]] ; then
|
||||||
out=$(npx prettier --check $file 2>&1 > /dev/null)
|
out=$(npx prettier --check $file 2>&1 > /dev/null)
|
||||||
retval="$?"
|
retval="$?"
|
||||||
success_retval=0
|
success_retval=0
|
||||||
@@ -43,6 +42,8 @@ elif [[ x"$retval" == x"$would_reformat_retval" ]] ; then
|
|||||||
exit 1
|
exit 1
|
||||||
elif [[ x"$retval" == x"$syntax_error_retval" ]] ; then
|
elif [[ x"$retval" == x"$syntax_error_retval" ]] ; then
|
||||||
echo -n "syntax error"
|
echo -n "syntax error"
|
||||||
|
echo
|
||||||
|
echo "$out"
|
||||||
exit 2
|
exit 2
|
||||||
else
|
else
|
||||||
echo -n "problem running reformatter"
|
echo -n "problem running reformatter"
|
||||||
|
|||||||
Reference in New Issue
Block a user