Skip to content

Instantly share code, notes, and snippets.

@cristianobecker
Last active January 10, 2020 05:30
Show Gist options
  • Save cristianobecker/a1bb0f619cea218dcd62 to your computer and use it in GitHub Desktop.
Save cristianobecker/a1bb0f619cea218dcd62 to your computer and use it in GitHub Desktop.
JSLint watch without gulp or grunt
# Ubuntu: apt-get intall entr
jslint-watch() {
local folder=$(test "x$1" != x && echo "$1" || echo .)
local files="find $folder -type f -name '*.js'"
local modified='$('"$files"' -printf "%T+ %p\n" | sort -r | head -1 | cut -d" " -f2)'
eval $files | entr sh -c 'jslint '"$modified"' --color'
}
# MacOS: brew install entr
jslint-watch() {
local folder=$(test "x$1" != x && echo "$1" || echo .)
find "$folder" -type f -name '*.js' | entr jslint /_ --color
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment