 <p>You can just add an argument to your main template that tells it whether or not to add the error stylesheet and script. Your main template handles the conditional statement and your other views just pass a true/false.</p> <p><strong>main.scala.html</strong></p> <pre><code>@(title: String, active: Int, hasErrors: Boolean = false)(content: Html)(style: Html)(js: Html) &lt;html&gt; &lt;head&gt; &lt;title&gt;@title&lt;/title&gt; @style @if(hasErrors){&lt;link rel="stylesheet" href="error.css" /&gt;} &lt;/head&gt; &lt;body&gt; ... @js @if(hasErrors){&lt;script src="error.js"&gt;&lt;/script&gt;} &lt;/body&gt; &lt;/html&gt; </code></pre> <p><strong>other.scala.html</strong> (For example)</p> <pre><code>@(form: Form[MyModel]) @main(title, active, form.hasErrors) { ... @if(form.hasErrors){ @errorTemplate(errorMessage) } ... } { &lt;!-- stylesheets --&gt; } { &lt;!-- javascripts --&gt; } </code></pre>