Jack Bister


grhp

Github link

There was a question one day at work - something like "Is anyone using the [margin] input on the card component in our component library?". Using a simple regex search in a text editor like <card.*margin was not enough in this situation since it wouldn't catch this:

<card
    [margin]="true">
...
</card>

So I quickly hacked together this little utility called grhp which uses jsdom to let you run CSS queries on HTML files on disk and returns the files containing any elements matching the selector. With grhp you could answer the question by using a command like this:

grhp -i "app/**/*.html" "card[\[margin\]]"

Maybe there was an easier way to answer the question. But it was a fun little thing to build!

You can install grhp from npm:

npm install -g grhp