So far I've only created the .map files manually withHi 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;
};
coffee -cm *.coffeefrom 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@dancer.pm
http://lists.preshweb.co.uk/mailman/listinfo/dancer-users