Dancer icon indicating copy to clipboard operation
Dancer copied to clipboard

App scaffolding templates

Open perlpilot opened this issue 13 years ago • 10 comments

Here are some changes to the dancer script to allow for an "application template" directory. It's not well tested yet, but I wanted some feedback.

It adds the --template/-t options such that you can use "application templates" to create new apps. The application templates are subdirectories of ~/.dancer_templates and they should contain everything you'd want in a dancer app.

The use-case is if you're always building dancer apps that use blueprint.css or prototype instead of jquery or come pre-packaged with some other functionality, you build a directory in ~/.dancer_templates that contains all of the necessary files and use "dancer -t my-template -a MyApp" to create new apps.

Anyway, feedback welcome!

perlpilot avatar Sep 29 '11 16:09 perlpilot

Looks like a good feature.

The only slight drawback is that this will need to be ported to gnusosa's Dancer::Script refactoring (which reminds me, I need to find out how close we are to merging that in, it looked good)

bigpresh avatar Sep 29 '11 16:09 bigpresh

Where is this Dancer::Script refactoring located?

perlpilot avatar Sep 29 '11 18:09 perlpilot

On Thursday 29 September 2011 19:40:07 Jonathan Scott Duff wrote:

Where is this Dancer::Script refactoring located?

Over on @gnusosa's fork: https://github.com/gnusosa/Dancer

bigpresh avatar Sep 29 '11 23:09 bigpresh

Released a new dev version. Once I release it as stable, I'm gonna merge @gnusosa's work.

xsawyerx avatar Oct 02 '11 16:10 xsawyerx

@xsawyerx, can I poke you to merge @gnusosa's work? Please? With sugar on top?

ambs avatar Nov 01 '11 17:11 ambs

@ambs let's see how easy this is...

xsawyerx avatar Nov 02 '11 21:11 xsawyerx

@ambs, @bigpresh, @perlpilot - I've put @gnusosa's work on the branch "refactoring/script". If you could resubmit this pull request based on that branch, and adapt it to that code, I would greatly appreciate it. :)

xsawyerx avatar Nov 30 '11 17:11 xsawyerx

I've made it such that

my $template = '<% foo %>';
template \$template, { foo => 42 };

works now.

I was trying to test some simple view code and didn't need or want to generate .tt files. I noticed that the underlying template code supported passing a scalar ref, but then your hooks won't run. The above change allows for the "full stack" template processing to happen and for the templates to be specified inline.

This is useful for extremely simple Dancer apps and, what I want it for, testing plugins that add functionality to templates.

perlpilot avatar Dec 08 '11 14:12 perlpilot

@ambs, @bigpresh, @perlpilot, @gnusosa @xsawyerx : where are we with this PR ? it seems to me that it can be merged alongside with gnusosa stuff ?

dams avatar Mar 22 '12 20:03 dams

poking here. Dams++ : can we have a brief on that one?

Thanks.

sukria avatar Mar 23 '12 13:03 sukria