Create a gist now

Instantly share code, notes, and snippets.

Getting word count for site from nunjucks/jinja2 template HTML files
# from views directory
# create .out files with HTML tags stripped
find . -name '*.html' -exec sh -c 'sed -e "s/<[^>]*>//g" $1 > $1.out' -- {} \;
# create .out.bout files with nunjucks/jinja2 tags stripped
find . -name '*.html.out' -exec sh -c 'sed -e "s/{[^}]*}//g" $1 > $1.bout' -- {} \;
# word count
find . -name '*.html.out.bout' | xargs wc -w
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment