<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">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>