I am looking to extend a stylesheet list in twig. I have stripped down the code as much as possible to illustrate what im trying to achieve.
base.html.twig
<!DOCTYPE html>
<html>
<head>
<title>Some title</title>
{% block stylesheets %}
<link href="css/bootstrap.min.css" rel="stylesheet" media="screen">
<link href="css/bootstrap-responsive.min.css" rel="stylesheet" media="screen">
<link href="css/custom-theme/jquery-ui-1.10.0.custom.css" rel="stylesheet" media="screen">
{% endblock %}
</head>
<body>
{% block content %}
.. content for body goes here etc
{% endblock content %}
</body>
<!-- rest of template --!>
I then reuse the base template but I dont want to relist all of the style sheets I just want to add one on the end of the list?
template that uses base
{% extends 'sjQueryBundle::base.html.twig' %}
{% block stylesheets %}
<link href="css/sales-journal.css" rel="stylesheet" media="screen">
{% endblock %}
{% block content %}
some template stuff here
{% endblock content %}
The problem with the above is it replaces the style-sheet block entirely I’m just looking to add sales-journal.css onto the end?
All you need is to call
parent()method, which will render contents of the parent block