desertcrocodile has asked for the wisdom of the Perl Monks concerning the following question:
Hey guys, I'm currently making a web app in Mojolicious, but cannot figure out why the css stylesheets and js files I'm linking are not showing up. I've put them in the public directory in the same directory as my application.
This is the default layout I'm using:
<!doctype html><html> <head> <title>Main title</title> <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11. +1/jquery.min.js"></script> <link rel="stylesheet" type="text/css" href="/programcss.css"> <script type="text/javascript" src="listCollapse.js"></script> </head> <body><%== content %></body> </html>
I've tried all sorts of combinations of pathways to link to the files, but nothing seems to be working. I'm using Windows 7, and testing it in Chrome if that helps.
Here is the code for the app itself:
#!/usr/bin/env perl use Mojolicious::Lite; use File::Slurp; use Data::Dump qw(dump); use lib 'lib'; use webprogramsubs; # Documentation browser under "/perldoc" plugin 'PODRenderer'; get '/' => sub { my $c = shift; $c->render('contents'); }; app->start; __DATA__ @@ contents.html.ep <html> % layout 'default'; <body> <h1>a heading</h1> </body> </html>
Any advice would be much appreciated!
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Mojolicious - linking external css/js not working.
by neilwatson (Priest) on Jul 23, 2014 at 18:51 UTC | |
by desertcrocodile (Initiate) on Jul 23, 2014 at 19:51 UTC | |
Re: Mojolicious - linking external css/js not working. ( taghelpers url_for / link_to / javascript / stylesheet )
by Anonymous Monk on Jul 23, 2014 at 21:24 UTC |