I am having trouble using Mojolicious::Plugin::RevealJS. It works it a Lite
app, but I fail to use it in a full app and I am unable to find where is
the issue.
I start the plugin with:
sub startup {
>
> my $self = shift;
>
> $self->plugin('RevealJS');
> ...
> my $r = $self->routes;
> ....
> $r->get('/revealjs/:id')->to('presenta#revealjs');
> ...
> }
>
In the controller, I start the plugin by using the revealjs layout:
> sub revealjs {
my $self = shift;
my $id_pres = $self->stash('id');
$self->render(
layout => 'revealjs',
template => 'mytalk',
id_pres => $id_pres
);
}
The app shows the content of the template, adds code from the plugin, but
fails to find the revealjs files when rendering the layout. These are the
paths that cannot be found when rendering the page:
GET http://127.0.0.1:3000/revealjs/revealjs/css/reveal.css
01:53 GET http://127.0.0.1:3000/revealjs/revealjs/lib/js/head.min.js
01:22 GET http://127.0.0.1:3000/revealjs/revealjs/lib/css/zenburn.css
01:19 GET http://127.0.0.1:3000/revealjs/revealjs/css/theme/black.css
01:54 GET http://127.0.0.1:3000/revealjs/revealjs/js/reveal.js
01:30 GET http://127.0.0.1:3000/revealjs/revealjs/css/print/paper.css
01:53 GET http://127.0.0.1:3000/revealjs/revealjs/lib/js/head.min.js
01:54 GET http://127.0.0.1:3000/revealjs/revealjs/js/reveal.js
01:72 Uncaught ReferenceError: Reveal is not defined
at 01:72
As the app calls the plugin but fails to find the revealjs files, I guess
the issue could be in how the code
<https://github.com/jberger/Mojolicious-Plugin-RevealJS> builds the paths,
and I imagine this is the relevant part:
package Mojolicious::Plugin::RevealJS;
...
use Mojo::Home;
...
use File::Basename 'dirname';
use File::Spec::Functions qw/rel2abs catdir/;
use File::ShareDir 'dist_dir';
has home => sub {
my $checkout = catdir(dirname(rel2abs(__FILE__)), qw/RevealJS files/);
Mojo::Home->new(-d $checkout ? $checkout : dist_dir(
'Mojolicious-Plugin-RevealJS'));
};
sub register {
my ($plugin, $app, $conf) = @_;
my $home = $plugin->home;
push @{ $app->static->paths }, $home->rel_dir('public');
push @{ $app->renderer->paths }, $home->rel_dir('templates');
$app->defaults('revealjs.init' => {
controls => \1,
progress => \1,
history => \1,
center => \1,
transition => 'slide', #none/fade/slide/convex/concave/zoom
});
$app->helper('include_code' => \&_include_code);
$app->helper('revealjs.export' => \&_export);
}
I would appreciate any hints!
Cheers!
--
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.