I'm using Mako template for a project. How can I add a CSS file in Mako?
I try to use <link type="stylesheet" type="text/css" href="<%include file='test.css' />" />
in the <head>
tag, but it doesn't work.
I'm using Mako template for a project. How can I add a CSS file in Mako?
I try to use <link type="stylesheet" type="text/css" href="<%include file='test.css' />" />
in the <head>
tag, but it doesn't work.
How about
${css_link('/css/filename.css', 'screen')}
Complete example code:
<% self.seen_css = set() %>
<head>
${self.css()}
</head>
<%def name="css_link(path, media='')">
% if path not in self.seen_css:
<link rel="stylesheet" type="text/css" href="${path|h}" media="${media}"></link>
% endif
<% self.seen_scripts.add(path) %>
</%def>
<%def name="css()">
${css_link('/css/main.css', 'screen')}
${css_link('/css/navigation.css', 'screen')}
${css_link('/css/forms-buttons.css', 'screen')}
${css_link('/css/orders.css', 'screen')}
</%def>