6

I have a flask project in which one of the pages needs to be self contained. I have a separate file whose content I need to insert into the html page's head.

What's the easiest way to do it?

1 Answer 1

13

Simply use the include statement to include the contents:

<style type="text/css">
{% include "your.css" %}
</style>
Sign up to request clarification or add additional context in comments.

1 Comment

Note that the path is relative from whatever folder is specified to be the template dir (typically, just "templates/"), meaning that if you're in a subfolder, you would need to include with the subfolder path. e.g. to include "about/hours.html" in "about/contact.html", the include would be {% include "about/hours.html" %}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.