Question

I've written a site for work, front end is JS/JQ/HTML hosted by an Apache2 server. Also, we wrote an API using Mojolicious. I'm not using Mojo for any HTML rendering at the moment, it's purely being used as a REST interface to a MySQL DB, which works well, but I'm looking into putting the HTML and JS into Mojo templates, and running up Mojo's own web server instead of Apache.

I have a good few thousand lines of JS/JQ code across the site, and I don't really want to just include them in a script tag in the HTML in a Mojo template, but I cannot for the life of me work out how to get Mojo to host up external JS/CSS files to the HTML template.

Can anyone offer some advice please?

Was it helpful?

Solution

Just put it all in the public directory. If public does not exist, create it in the same folder as your app and Mojo will use it.

More info on static http://mojolicio.us/perldoc/Mojolicious/Static

OTHER TIPS

use helper: content_for

in your layout:

%= content_for 'header'

in your template:

% layout 'default';
% content_for header => begin
script, link tags here
% end
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top