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 <[email protected]> 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 > [email protected] > http://lists.preshweb.co.uk/mailman/listinfo/dancer-users > >
_______________________________________________ dancer-users mailing list [email protected] http://lists.preshweb.co.uk/mailman/listinfo/dancer-users
