peterbe / mincss

Tool for finding out which CSS selectors you're NOT using.
https://peterbe.github.io/mincss/
BSD 3-Clause "New" or "Revised" License
855 stars 92 forks source link

Recursively looks for urls for a given url from same host #8

Closed gobelinus closed 6 years ago

gobelinus commented 11 years ago

Given a url, tries to find urls from a['href'] and parses them if links are from same host, basically to handle use case when same css file is used across multiple pages and instead of passing multiple urls, single url will do.

Also ignores, urls like 'javascript:', 'mailto:'.

Ignores query string and fragments from url while comparing urls.

peterbe commented 11 years ago

Thanks. That's a good start but I think it needs some thought.

You can already supply multiple URLs but you do it from the outside. I.e. you can write a script that does the spidering and then calling mincss from there. Would you consider making it some sort of plugin? Perhaps a repo called recursive-mincss.

gobelinus commented 11 years ago

you can write a script that does the spidering and then calling mincss from there.

That was the purpose of writing recursive thing to avoid usage of external script. It can always be converted to a plugin but any outside script/plugin will result in duplication specially wrt fetching urls, and parsing html.

Alternatively, I think we can have a new param which can determine recursive nature.

e.g.

if self.recursive \
     and url not in self.url_queue:
         self.url_queue.append(url)
peterbe commented 6 years ago

Too old now.