<div dir="ltr"><div>Have you tried serving the static files using a Plack middleware as well?<br><br></div>Have you solved this problem? It would make a great Advent Calendar article.<br></div><div class="gmail_extra"><br>

<br><div class="gmail_quote">On Fri, Oct 25, 2013 at 12:16 PM, Pierre M <span dir="ltr"><<a href="mailto:piemas25@gmail.com" target="_blank">piemas25@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">

<div dir="ltr"><div><div>Hi everyone,<br><br></div><div>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. <br>



<br></div><div>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/<a href="http://app.pl" target="_blank">app.pl</a> to make my plack server compile the .coffee files to .js:<br>



</div><br>#!/usr/bin/env perl<br>use FindBin;<br>use lib "$FindBin::Bin/../lib";<br><br>use HabitLab;<br>use Plack::Builder;<br><br>builder {<br><br>    enable 'Compile' => (   # Plack::Middleware::Compile<br>



        pattern => qr{\.coffee$},<br>        lib     => 'public/coffee',<br>        blib    => 'public/coffee',<br>        mime    => 'text/plain',<br>        map     => sub {<br>            my $filename = shift;<br>



            $filename =~ s/coffee$/js/;<br>            say "    * FILE: $filename";<br>            return $filename;<br>        },<br>        compile => sub {<br>            my ( $in, $out ) = @_;<br>            say "    * IN: $in, OUT: $out";<br>



            system("coffee --compile --map --stdio < $in > $out");<br>        }<br>    );<br><br>    HabitLab->dance;<br>};<br><br></div>So far I've only created the .map files manually with<br><br>



coffee -cm *.coffee<br><div><br></div><div>from inside the public/coffee folder.<br></div><div>I've tried to modify the source paths inside the .js and .map files, with no success.<br></div><div><br></div><div>Any idea of what I might have missed?<br>



</div><div><br><div><div dir="ltr">---<br>I check email a couple times daily; to reach me sooner, you can send me a text message via this page: <a href="https://awayfind.com/mascip" target="_blank">https://awayfind.com/mascip</a><br>



</div></div>
</div></div>
<br>_______________________________________________<br>
dancer-users mailing list<br>
<a href="mailto:dancer-users@dancer.pm">dancer-users@dancer.pm</a><br>
<a href="http://lists.preshweb.co.uk/mailman/listinfo/dancer-users" target="_blank">http://lists.preshweb.co.uk/mailman/listinfo/dancer-users</a><br>
<br></blockquote></div><br></div>