Skip to content Skip to sidebar Skip to footer

Thymeleaf + Html5 - Can't Find Js Or Css

I'm working on a new application using Thymeleaf that's built upon another one. But instead of fast forwarding the development, I'm stuck on a issue for the better part of the nigh

Solution 1:

By default, Thymeleaf expects us to place templates in the src/main/resources/templates folder.

And for CSS and JavaScript files, the default directory is src/main/resources/static.

Change your resources folder structure to:

srcmain
      resources
         static
            css
            img
            js
         templates
            admin
            fragments
            home
            login.html

CSS usage e.g.

<link th:href="@{/css/beyond-login.css}" rel="stylesheet" />

JS usage e.g.

<scripttype="text/javascript"th:src="@{/js/beyond.js}"></script>

Post a Comment for "Thymeleaf + Html5 - Can't Find Js Or Css"