본문 바로가기

Backend/SpringBoot

[Thymeleaf] Resource Versioning

css, js 파일 수정 시 버저닝을 통해 브라우저 캐시 초기화할 필요없이 프론트 개발 및 테스트

 

application.yml 설정 추가

spring:
  web:
    resources:
      chain:
        strategy:
          content:
            enabled: true
            paths: /css/**, /js/**

html 에서 사용법

    <link rel="stylesheet" th:href="@{/css/main.min.css}">
    <script th:src="@{/js/main.min.js}"></script>

개발자 도구로 결과 확인

https://stackoverflow.com/questions/48732894/spring-mvc-and-thymeleaf-resource-versioning

 

Spring MVC and Thymeleaf Resource Versioning

I am trying resource versioning with Spring Mvc 4.I use thymeleaf template engine.But doesnt work with the following code.When load the page I cant see new version Url when i view the page source.S...

stackoverflow.com