Finding Missing Handlebars Views

Just a quick post about a solution I thought up to finding missing handlebars views in my project.

grep -oEr "{{> [-a-zA-Z0-9\/_]+" ./app/server/views | grep -oE "[-a-zA-Z0-9\/_]+$" | sort | uniq | while read -r line ; do
    if [ ! -e "./app/server/views/partials/$line.hbs" ]
        echo "./app/server/views/partials/$line.hbs"

This just greps for the {{> stem and then re-greps for the path part. Then it sorts and drops duplicate values. For each path, it checks to see if a file exists. If it doesn't, it outputs it. I'm sure a more elegant solution exists.

That is all, carry on with your lives.

Show Comments