tmcw/sitemap-static — pull request #1 by thomporter (2014-06-12 09:00:58+00:00)
Title: Improvements

I have a project I needed something like this for, was glad to find an existing node module to work with! =)

Before I could get it to work, I had to add the #!/usr/bin/env node line to get it to run.... How is it you're running w/o it?

Next, I have a slew of files and folders I don't want in the sitemap, but I'll be re-generating it almost daily for a while. I didn't want to have to edit the file every time, so I added a way to have it ignore stuff.

In-depth explanation: I added the --ignore-file parameter (taking the lead from rsync) to point to a JSON file with an array of stuff to ignore. I considered letting this be a flat file, like rsync's, but I'm lazy, and doing a require() on a json file is super simple. =) Next I have the script run through the array, looking for any non-html files (ie, directories) and then have it put them in a separate array as regular expressions, for fast comparison later. Then, in the file loop, I make sure the file isn't in the ignore files array, and that it's path doesn't match that of any ignored directories.

Thoughts?