benkeen / grunt-search

Grunt plugin that searches a list of files and logs all findings in various formats.
MIT License
15 stars 8 forks source link

Have searchString accept arrays #6

Closed betsydupuis closed 9 years ago

betsydupuis commented 9 years ago

I was hoping to use this in a project, but I need to search for a large set of data in an array rather than a single string or regex.

benkeen commented 9 years ago

Interesting! So if you could define an array of strings/regexps for the searchString field, would that work for you?

...
short_tags: {
    files: {
        src: ["**/*.php"]
    },
    options: {
        searchString: [
            /(<\?[^p])|(<\?$)/,
            "a string"
        ],
        logFormat: "console"
    }
},
... 

EDIT: doh. I just re-read the title of the issue. Got it. :)

This is a good idea, I'll totally add it for the next version.

betsydupuis commented 9 years ago

Yes, a string or regex in an array would be perfect! I have a list of pngs that I want to check if they being used anywhere in an application.

benkeen commented 9 years ago

Hey @itsjustluck - I just released 0.1.7 that allows you to include an array of strings/regexps. Mind giving it a go? If you have any problems with it, just raise a ticket. :)

betsydupuis commented 9 years ago

I've been taking a look at it. It's really slow. :-/

It's a really big query. I'm look for ways to lighten the load. I'm thinking about using Cheerio to thin out my search to just src and style attributes.

benkeen commented 9 years ago

Cool! And yeah, there are definitely improvements that could be made to this repo too - speed-wise, I mean.