[dancer-users] Dancer and Coffeescript

Pierre M piemas25 at gmail.com
Fri Dec 6 15:05:08 GMT 2013


No, I haven't tried this. I could try it with Plack::Middleware::Static.

I'm going on holidays on Sunday and I won't have the time to solve this
problem before then,so that will be too late for the calendar.

Thank you for answering all these messages

--- Pierre Masci
I check email a couple times daily; to reach me sooner, you can send me a
text message via this page: https://awayfind.com/mascip


On 6 December 2013 14:52, sawyer x <xsawyerx at gmail.com> wrote:

> Have you tried serving the static files using a Plack middleware as well?
>
> Have you solved this problem? It would make a great Advent Calendar
> article.
>
>
> On Fri, Oct 25, 2013 at 12:16 PM, Pierre M <piemas25 at gmail.com> wrote:
>
>> Hi everyone,
>>
>> I have managed to make Coffeescript work with my Dancer2 app, but I'm
>> facing an additional challenge: Source maps won't work, and I'm guessing it
>> might be caused by my files structures. If anyone has managed to use Dancer
>> with Coffeescript's source maps, I would appreciate some help.
>>
>> My file structure is simple: all my .coffee files are in public/coffee.
>> And their .js and .map counterparts are in this same folder too. Here is
>> what I've done in bin/app.pl to make my plack server compile the .coffee
>> files to .js:
>>
>> #!/usr/bin/env perl
>> use FindBin;
>> use lib "$FindBin::Bin/../lib";
>>
>> use HabitLab;
>> use Plack::Builder;
>>
>> builder {
>>
>>     enable 'Compile' => (   # Plack::Middleware::Compile
>>         pattern => qr{\.coffee$},
>>         lib     => 'public/coffee',
>>         blib    => 'public/coffee',
>>         mime    => 'text/plain',
>>         map     => sub {
>>             my $filename = shift;
>>             $filename =~ s/coffee$/js/;
>>             say "    * FILE: $filename";
>>             return $filename;
>>         },
>>         compile => sub {
>>             my ( $in, $out ) = @_;
>>             say "    * IN: $in, OUT: $out";
>>             system("coffee --compile --map --stdio < $in > $out");
>>         }
>>     );
>>
>>     HabitLab->dance;
>> };
>>
>> So far I've only created the .map files manually with
>>
>> coffee -cm *.coffee
>>
>> from inside the public/coffee folder.
>> I've tried to modify the source paths inside the .js and .map files, with
>> no success.
>>
>> Any idea of what I might have missed?
>>
>> ---
>> I check email a couple times daily; to reach me sooner, you can send me a
>> text message via this page: https://awayfind.com/mascip
>>
>> _______________________________________________
>> dancer-users mailing list
>> dancer-users at dancer.pm
>> http://lists.preshweb.co.uk/mailman/listinfo/dancer-users
>>
>>
>
> _______________________________________________
> dancer-users mailing list
> dancer-users at dancer.pm
> http://lists.preshweb.co.uk/mailman/listinfo/dancer-users
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.preshweb.co.uk/pipermail/dancer-users/attachments/20131206/4ecb3489/attachment.html>


More information about the dancer-users mailing list