eudicots/Cactus

Bug: .htaccess and .htpasswd aren't included in built files

Opened this issue · 3 comments

I'm hoping to require a password on my site, but when I add a .htaccess file and build, it's stripped out of the built directory.

The cactus build pipeline is skipping "dot files" so the best way to achieve this would be with a plugin for cactus.

It would probably be wise to have the plugin retrieve a list of files to be copied from the config.json.

Let me know if you still need a hand with this.

I wrote a simple plugin just for .htaccess, but it probably makes sense to make it configurable as @dwightgunning suggested

import os, os.path
import sys
import shutil

def postBuild(site):
    htaccess_path = os.path.join(site.paths['pages'], ".htaccess")
    if os.path.isfile(htaccess_path):
        shutil.copy(htaccess_path, site.paths['build'])

Nice one!

You should pop it in a PR and see if @krallin will include it in master. If you don't have time I could also do it (and credit you).