Dancer2-Plugin-JSManager
view release on metacpan or search on metacpan
lib/Dancer2/Plugin/JSManager.pm view on Meta::CPAN
;Path to local js file in case CDN is unavailable
fallback: '/js/jquery-1.11.1.min.js'
; This library depends on the previous library so we put it second
- jqm:
uri: 'http://code.jquery.com/mobile/1.4.5/jquery.mobile-1.4.5.min.js'
fallback: '/js/jquery.mobile-1.4.5.min.js'
- growler:
; if a file is not on a CDN simply put the path to the local file
uri: '/js/jquery.growl.min.js'
; control where in the template the javascript will appear (see below for more explanation)
injection_pt: 'body_top'
After modifying your config file, all you have to do is put a variable called C<js_head>
in the head portion of your tempalte. So, for example, if you are using L<Template::Toolkit>,
you would add the following into the C<<head\>> section of your HTML template:
[% js_head %]
If you want to inject the javascript into different parts of your page, you can do that with a
custom variable determined by the "injection_pt" property, preceded by C<js_>.
So, from the example above, the growler script has the C<injection_pt> set to C<body_top> so you would
place the following in the appropriate place in your template:
[% js_body_top %]
If you are using templating modules other than L<Template::Toolkit>, consult its ducmentation for the
appropriate syntax.
=head1 DEPENDENCIES
None
=head1 INCOMPATIBILITIES
None reported.
=for :stopwords cpan testmatrix url annocpan anno bugtracker rt cpants kwalitee diff irc mailto metadata placeholders metacpan
=head1 SUPPORT
=head2 Perldoc
You can find documentation for this module with the perldoc command.
perldoc Dancer2::Plugin::JSManager
=head2 Source Code
The code is open to the world, and available for you to hack on. Please feel free to browse it and play
with it, or whatever. If you want to contribute patches, please send me a diff or prod me to pull
from your repository :)
L<https://github.com/sdondley/Dancer2-Plugin-JSManager>
git clone git://github.com/sdondley/Dancer2-Plugin-JSManager.git
=head1 BUGS AND LIMITATIONS
You can make new bug reports, and view existing ones, through the
web interface at L<https://github.com/sdondley/Dancer2-Plugin-JSManager/issues>.
=head1 MOTIVATION
I'm new to Dancer2 development and wrote this plugin to scratch a minor itch and to learn how to write a basic Dancer2 module.
=head1 DEVELOPMENT NOTES
This software is actively maintained. Further releases are expected to help exercise my budding software development skills. Feedback, suggestions, and contributions are greatly appreciated and welcome.
Eventually, I'd like to improve this module to automatically download external javascripts to the local machine and periodically download fresh copies (perhaps once a day) to ensure the local js copy is in sync with the CDN. I also want to add a feat...
Longer term, I'm interested in exploring the possibility of making an admin interface for updating the settings configration file. Another possible future feautre is the selection of a CDN for based on the name of some of the more the popular librari...
=head1 AUTHOR
Steve Dondley <s@dondley.com>
=head1 COPYRIGHT AND LICENSE
This software is copyright (c) 2017 by Steve Dondley.
This is free software; you can redistribute it and/or modify it under
the same terms as the Perl 5 programming language system itself.
=head1 DISCLAIMER OF WARRANTY
BECAUSE THIS SOFTWARE IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
FOR THE SOFTWARE, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
PROVIDE THE SOFTWARE "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER
EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE
ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE SOFTWARE IS WITH
YOU. SHOULD THE SOFTWARE PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL
NECESSARY SERVICING, REPAIR, OR CORRECTION.
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
REDISTRIBUTE THE SOFTWARE AS PERMITTED BY THE ABOVE LICENCE, BE
LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL,
OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE
THE SOFTWARE (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
FAILURE OF THE SOFTWARE TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
SUCH DAMAGES.
=cut
( run in 0.594 second using v1.01-cache-2.11-cpan-39bf76dae61 )