Hi,
My guess is that your route ('/revealjs/:id') interferes with requests
for the static Reveal.js files bundled in the plugin,
which are served from /revealjs/...
This line in the plugin's register() method:
push @{ $app->static->paths }, $home->rel_dir('public');
adds the directory "public" in the plugin to the paths Mojolicious will
search for files, and that directory contains a folder called "revealjs".
So, try renaming your route and see if things improve?
- Dotan
On 16/01/17 10:51, mimosinnet wrote:
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:
|
substartup {
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:
|
subrevealjs {
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:53GET http://127.0.0.1:3000/revealjs/revealjs/lib/js/head.min.js
01:22GET http://127.0.0.1:3000/revealjs/revealjs/lib/css/zenburn.css
01:19GET http://127.0.0.1:3000/revealjs/revealjs/css/theme/black.css
01:54GET http://127.0.0.1:3000/revealjs/revealjs/js/reveal.js
01:30GET http://127.0.0.1:3000/revealjs/revealjs/css/print/paper.css
01:53GET http://127.0.0.1:3000/revealjs/revealjs/lib/js/head.min.js
01:54GET http://127.0.0.1:3000/revealjs/revealjs/js/reveal.js
01:72UncaughtReferenceError:Revealisnotdefined
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:
|
packageMojolicious::Plugin::RevealJS;
...
useMojo::Home;
...
useFile::Basename'dirname';
useFile::Spec::Functionsqw/rel2abs catdir/;
useFile::ShareDir'dist_dir';
has home =>sub{
my$checkout =catdir(dirname(rel2abs(__FILE__)),qw/RevealJSfiles/);
Mojo::Home->new(-d $checkout ?$checkout
:dist_dir('Mojolicious-Plugin-RevealJS'));
};
subregister{
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]
<mailto:[email protected]>.
To post to this group, send email to [email protected]
<mailto:[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.