Use js-beautify for formatting HTML #1089
24
.travis.yml
24
.travis.yml
|
@ -1,11 +1,19 @@
|
|||
language: ruby
|
||||
rvm:
|
||||
- 2.4.1
|
||||
matrix:
|
||||
include:
|
||||
- language: ruby
|
||||
rvm: 2.4.1
|
||||
|
||||
# Assume bundler is being used, therefore
|
||||
# the `install` step will run `bundle install` by default.
|
||||
script: ./build.sh
|
||||
# Assume bundler is being used, therefore
|
||||
# the `install` step will run `bundle install` by default.
|
||||
script: ./build.sh
|
||||
|
||||
sudo: false # route your build to the container-based infrastructure for a faster build
|
||||
sudo: false # route your build to the container-based infrastructure for a faster build
|
||||
|
||||
cache: bundler # caching bundler gem packages will speed up build
|
||||
cache: bundler # caching bundler gem packages will speed up build
|
||||
|
||||
- language: node_js
|
||||
node_js: v12.7.0
|
||||
branches:
|
||||
only:
|
||||
- master
|
||||
script: npm run format-test:html
|
|
@ -1,12 +1,14 @@
|
|||
#!/bin/bash
|
||||
|
||||
# A custom script, that formats the file(s) with html-beautify,
|
||||
# but instead of changing it, it only errors with 0/1 if it needs to be changed
|
||||
# Ref: https://web.archive.org/web/20190522172323/https://medium.com/@jtomaszewski/keep-your-code-clean-forever-65c71f7f2df
|
||||
APPDIR=$(realpath $(dirname $(dirname $0)))
|
||||
APPDIR=$(readlink -f $(dirname $(dirname $0)))
|
||||
TMPDIR=$(mktemp -d)
|
||||
cd $APPDIR
|
||||
|
||||
for line in $*; do
|
||||
filepath=$(realpath $line)
|
||||
filepath=$(readlink -f $line)
|
||||
file=${filepath/$APPDIR\//}
|
||||
mkdir -p $TMPDIR/$(dirname $file)
|
||||
cp $APPDIR/$file $TMPDIR/$file
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
"build": "bundle exec jekyll build",
|
||||
"serve": "bundle exec jekyll serve",
|
||||
"format:html": "node bin/get-html-ls.js | xargs node_modules/.bin/html-beautify -r",
|
||||
"format-test:html": "node bin/get-html-ls.js | xargs bash bin/html-beautify-check.sh"
|
||||
"format-test:html": "node bin/get-html-ls.js | xargs bash ./bin/html-beautify-check.sh"
|
||||
},
|
||||
"husky": {
|
||||
"hooks": {
|
||||
|
|
Reference in New Issue