Created
May 4, 2017 14:17
-
-
Save stevenalexander/7a122fdf6a6c324f6ceb345cda450c70 to your computer and use it in GitHub Desktop.
Getting word count for site from nunjucks/jinja2 template HTML files
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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