If you want to put them on CPAN, you will at least need a dummy (empty)
module with a version number to make them installable. Once you decide on
that module name (something that Mojo core is not likely to want in the
future), you can put the templates inside that namespace. Another problem
however is making the templates usable once installed, as only
Mojolicious's own install path will automatically be used.

I would recommend packaging it as a plugin, so that you can then have the
plugin add the installed path to the renderer's namespace, similar to in
the example here:
https://metacpan.org/pod/Mojolicious::Guides::Cookbook#Making-your-application-installable
(but don't change the application's home, just add your path to
@{$app->renderer->paths} ) Example:

package My::Templates::Plugin;
use Mojo::Base 'Mojolicious::Plugin';
use File::Basename 'basename';
use File::Spec::Functions 'catdir';

sub register {
  my ($self, $app, $config) = @_;
  my $template_dir = catdir dirname(__FILE__), 'templates';
  push @{$app->renderer->paths}, $template_dir;
}

You can also package the templates in a sharedir instead of in the lib
directory (note that only ExtUtils::MakeMaker will install arbitrary
templates in the lib directory, but all installers can use
File::ShareDir::Install). Then your plugin's register method would use
File::ShareDir or File::Share to find the installed sharedir.

Hope this helps,
-Dan

On Tue, Nov 22, 2016 at 2:53 PM, John Scoles <[email protected]> wrote:

>
> I have a set of  AJAX web form templates that I think would most of us
> here at Mojolicious would enjoy using.
>
> I was going to put them up on CPAN but I do not know what name space to
> use for just a set of templates and are not tied to any specific App or
> controller.
>
> Couldn't find a space for them as they are just .ep files
>
> The only place I could think of was
>
> *Mojolicious*
> <https://metacpan.org/source/SRI/Mojolicious-7.10/lib/Mojolicious> /
> *resources*
> <https://metacpan.org/source/SRI/Mojolicious-7.10/lib/Mojolicious/resources>
> / *templates*
> <https://metacpan.org/source/SRI/Mojolicious-7.10/lib/Mojolicious/resources/templates>
> / mojo
>
> any sugestions??
>
>
>
> The contents of this e-mail and any attachments are intended solely for the 
> use of the named addressee(s) and may contain confidential and/or privileged 
> information. Any unauthorized use, copying, disclosure, or distribution of 
> the contents of this e-mail is strictly prohibited by the sender and may be 
> unlawful. If you are not the intended recipient, please notify the sender 
> immediately and delete this e-mail.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Mojolicious" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To post to this group, send email to [email protected].
> Visit this group at https://groups.google.com/group/mojolicious.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Mojolicious" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/mojolicious.
For more options, visit https://groups.google.com/d/optout.

Reply via email to