title: Working with thymeleaf fragments
body: <p>I'm working on app with Spring and Thymeleaf and I wonder how to work with thymeleaf fragments.</p>
  
  <p>The advantage of Thymeleaf vs JSP is that we don't have to run application to see the template, but, when we split the template to fragments it will look like this:</p>
  
  <pre><code>&lt;body&gt;
      &lt;nav th:replace="fragments/header :: navbarMain"&gt;&lt;/nav&gt;
      &lt;div th:replace="fragments/header :: modalLogin"&gt;&lt;/div&gt;
  &lt;/body&gt;
  </code></pre>
  
  <p>The problem is that without running the app, the template will not be processed and we will see nothing in browser.
  What is the good practice to deal with such scenarios? Should I create "fake" navbar here and then use th:replace, like:</p>
  
  <pre><code>&lt;body&gt;
      &lt;nav th:replace="fragments/header :: navbarMain" class="fake-header"&gt;&lt;/nav&gt;
      &lt;div th:replace="fragments/header :: modalLogin"&gt;&lt;/div&gt;
  &lt;/body&gt;
  </code></pre>
  
  <p>or there is some better way?</p>