Dancer-Plugin-Device-Layout
view release on metacpan or search on metacpan
Example.pod view on Meta::CPAN
The layouts can help you easily setup device (mostly screen size) optimized
looks for your web application.
=head1 MyApp
I<MyApp> is the web application used for this example.
=head2 Import plugin
You need to load the plugin first ofcourse.
package MyApp;
use Dancer ':syntax';
use Dancer::Plugin::Device::Layout;
our $VERSION = '0.1';
get '/' => sub {
template 'index';
}
true;
=head2 Update L<Dancer/template|template> calls
You need to update every L<Dancer/template|template> call.
package MyApp;
use Dancer ':syntax';
use Dancer::Plugin::Device::Layout;
our $VERSION = '0.1';
get '/' => sub {
my $tokens = {};
my $options = { device_layout };
template 'index', $tokens, $options;
}
true;
=head2 Update C<config.yml>
Now you can modify the defaults of L<Dancer::Plugin::Device::Layout> by
update your C<config.yml>.
# This is the main configuration file of your Dancer app
# env-related settings should go to environments/$env.yml
# all the settings in this file will be loaded at Dancer's startup.
# Your application's name
appname: "MyApp"
# The default layout to use for your application (located in
# views/layouts/main.tt)
layout: "main"
# when the charset is set to UTF-8 Dancer will handle for you
# all the magic of encoding and decoding. You should not care
# about unicode within your app when this setting is set (recommended).
charset: "UTF-8"
# template engine
# simple: default and very basic template engine
# template_toolkit: TT
template: "simple"
# template: "template_toolkit"
# engines:
# template_toolkit:
# start_tag: '[%'
# end_tag: '%]'
# Here comes the Dancer::Plugin::Device::Layout configuration.
plugins:
Device::Layout:
normal_layout: normal
mobile_layout: mobile
tablet_layout: tablet
no_tablet: 0
tablet_as_mobile: 0
no_mobile: 0
=head2 Done
Now you are done with integrate L<Dancer::Plugin::Device::Layout> in your
L<Dancer> web application.
( run in 2.238 seconds using v1.01-cache-2.11-cpan-39bf76dae61 )