FTP Deployments with Hexo
Automating deployments with Hexo
I think this might be the last big missing puzzle piece to this blog: easy deployments.
But I had run into issues using the deployment before. See, I have a couple of sites that are not part of the blog. They are standalone sites that live in folders under the site root. By default, the FTP plugin will blow away whatever is in the remote folder before deploying. This is less than ideal.
In the sample options, though, is an
ignore property. Good luck finding documentation about it, there’s very little. In essence, the FTP plugin is a wrapper around
ftpsync, a node FTP module. In the docs for that module is this nugget:
ignore - the list of file patterns to ignore. Vague, but helpful.
I still couldn’t find many examples of using it, so armed with that little bit of help and a hunch that it was using globs, I tried to configure my own site. And it worked!
Now I can use
hexo deploy --generate to generate and deploy the site in one go. The files and folders specified are left alone. Perfect!
Only one little weird issue remains: on Windows, that command doesn’t exit properly. It finishes just fine, but I have to use CTRL+C to get back to a normal command prompt. Ah, well.