eudicots / Cactus

Static site generator for designers. Uses Python and Django templates.
BSD 3-Clause "New" or "Revised" License
3.46k stars 314 forks source link

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

Open rachelhannah1219 opened 8 years ago

rachelhannah1219 commented 8 years ago

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.

dwightgunning commented 8 years ago

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.

tiefpunkt commented 8 years ago

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'])
dwightgunning commented 8 years ago

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).