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
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:
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.
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.
I'm not sure whether File::ShareDir is a solution, because these files are mostly supposed to be copied into the application directory and modified there.
But maybe the underlying idea is to amend Dancer (resp. dancer) to use the data from the Bootstrap distribution and to generate the default files from it in addition to its other default files.