Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ability to inject custom html elements in the head element #1872

Merged
merged 3 commits into from
Sep 3, 2021

Conversation

fabito
Copy link
Contributor

@fabito fabito commented Sep 3, 2021

Problem

There is no (SSR) way to inject custom elements in the head when extending the index.html jinja2 template

Solution

Add a new jinja2 block extend_head to the index.html template to improve customizability. For example:

{% extends "index.html" %}

{% block extended_head %}
<link rel="stylesheet" type="text/css" href="./extend/static/extend.css?v={{ version }}" media="screen">
{% endblock extended_head %}

Test

This is how the extend_web_ui example looks like with the new table styling:

Screenshot from 2021-09-03 18-44-03

@cyberw
Copy link
Collaborator

cyberw commented Sep 3, 2021

LGTM. One small thing, could you maybe add a comment describing what the extra css actually does? Or perhaps just name the file something more to the point instead of extend.css?

@fabito
Copy link
Contributor Author

fabito commented Sep 3, 2021

Sorry I couldn't think of a more interesting example...

@cyberw cyberw merged commit 444640f into locustio:master Sep 3, 2021
@fabito fabito deleted the feature/add-extended_head-block branch September 3, 2021 08:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants