abw / Template2

Perl Template Toolkit v2
http://template-toolkit.org/
146 stars 94 forks source link

Feature: Copy/Link file trees #269

Open sciurius opened 4 years ago

sciurius commented 4 years ago

Currently, the ttree copy and link settings specify patterns to be matched against the file basenames. I would like to extend this to path names.

Rationale: Often a site has a bunch of static information (images, documents, js, ...) that always must be copied as-is. It is conventional to put these in a folder 'assets'. To specify to ttree that this folder must be copied as-is, a config command

copy = ^assets/

would be appropriate, To accomplish this, apply the attached trivial patch. Chances of breaking existing configs are minimal.

Alternatively a new setting assets could be introduced to specify one or more folders that always must be copied as-is.

If we can agree on an approach I offer to provide implementation PRs.

atoomic commented 4 years ago

Why not using a different keyword like copy_dir? This way we would reduce the risk of introducing a regression on existing usages of copy and make the intent clear, that this is a directory you want to copy?

sciurius commented 4 years ago

Yes, that's what i meant (intended to mean) when I proposed assets (I called it a setting but I meant keyword). Ideally, copying would still be subject to the link settings, mainly to prevent long copy times and disk use during development.