Manage HTML Template Dependencies With npm in a Spring Boot Project

I have a Spring Boot project where I am using HTML templates with Thymeleaf. The templates have dependencies, and I want to manage these dependencies using npm. My goal is to have an npm build command that copies all the relevant files from the source folder to the resources/static and resources/templates folders.

Project setup:

  • Using Gradle for the Java build
  • The build should be fully automated

Specific libraries I am using:

  • jQuery
  • Bootstrap (including Bootstrap CSS from node_modules)

Currently I am downloading the dependencies manually, but I feel like this is not the best solution.

I would appreciate some tips or maybe even a link to a GitHub project with a similar setup.