Java/Spring Framework

Thymeleaf 문법

Yo soy 2024. 3. 16. 03:37

일반적인 css 참조 문법

<link href="./vendors/bootstrap/dist/css/bootstrap.min.css" rel="stylesheet">
<link href="./vendors/font-awesome/css/font-awesome.min.css" rel="stylesheet">
<link href="./customized/project.css" rel="stylesheet">

 

타임리프에서 css 참조 문법

<link th:href="@{/vendors/bootstrap/dist/css/bootstrap.min.css}" rel="stylesheet">
<link th:href="@{/vendors/font-awesome/css/font-awesome.min.css}" rel="stylesheet">
<link th:href="@{/vendors/nprogress/nprogress.css}" rel="stylesheet">

 


일반적인 js 참조 문법

<script src="/vendors/jquery/dist/jquery.min.js"></script>
<script src="/vendors/bootstrap/dist/js/bootstrap.bundle.min.js"></script>
<script src="/vendors/fastclick/lib/fastclick.js"></script>
<script src="/vendors/nprogress/nprogress.js"></script>

 

타임리프에서 js 참조 문법

<script th:src="@{/vendors/jquery/dist/jquery.min.js}"></script>
<script th:src="@{/vendors/bootstrap/dist/js/bootstrap.bundle.min.js}"></script>
<script th:src="@{/vendors/fastclick/lib/fastclick.js}"></script>
<script th:src="@{/vendors/nprogress/nprogress.js}"></script>

 

 

참고 문서 :

 

Standard URL Syntax - Thymeleaf

The Thymeleaf standard dialects –called Standard and SpringStandard– offer a way to easily create URLs in your web applications so that they include any required URL preparation artifacts. This is done by means of the so-called link expressions, a type

www.thymeleaf.org