Twitter Bootstrap templates for Dancer Applications

I'm writing an internal application using Dancer. To give it a "current" look, I'm using the Twitter Bootstrap CSS framework. A side effect is, that I wrote Dancer::Layout::Bootstrap, a set of Template Toolkit templates that import the Bootstrap layout into Dancer. I hope that this will evolve into a way to add external data files and maybe even layout templates to scaffolding frameworks such as Dancer.

Pretty Pictures

Dancer Start Screen with Bootstrap

The demo application has a tiny bit of logic to demonstrate the effect of showing "flash messages" with Bootstrap, the green bar you see in the below image:

Dancer Screen with User and Message

The issue why I haven't released this onto CPAN yet is that I'm not aware of a better way to distribute ephemeral projects like templates and Javascript via the CPAN toolchain than to package them into a module / application. Maybe Dancer will come up with an API to load data from modules or to create/update templates from modules, or somebody will point me to an appropriate method to do such things in the comments.

4 Comments

This is great. I had been considering something like this myself. Thanks for beating me to it :-)

> The issue why I haven't released this onto CPAN yet is that I'm not aware of a better way to distribute ephemeral projects like templates and Javascript via the CPAN toolchain than to package them into a module / application.

Not quite sure what you mean by ephemeral projects (in relation to templates/javascript), but possibly the answer you are looking for is File::ShareDir and the associated "install_share" functions from Module::Install or Module::Build. They allow you to install non-module data and then find it again at runtime. That works fine if you want to distribute them inside your distribution.

Maybe take a look at JS::jQuery and Resource::Pack::jQuery. Each are different approaches at packaging Javascript on CPAN.

Leave a comment

About Max Maischein

user-pic I'm the Treasurer for the Frankfurt Perlmongers e.V. . I have organized Perl events including 9 German Perl Workshops and one YAPC::Europe.