What tools are recommended for comping LESS files into CSS within a Spring Boot web app? I am using Thymeleaf and Maven and I am setting up a sample project. I wanted to import my current project's LESS files in to this sample project. Thanks for any recommendations.
1 Answers
You're asking about the compilation, however, Spring boot is a runtime framework. I understand that you should compile *.less files into *.css files during the build and then just package the CSS files into spring boot application and make the application serve the static content.
Another option is not to pack the static files into the application but place them somewhere else (here the list of options will vary from some webserver like apache or Nginx to S3 bucket or even CDN) so that the java server won't deal with the static content and instead will totally concentrate on backend processing.
So, given maven is a build tool of your choice and you want to use maven to compile less into CSS, you should look for plugins doing this.
Quick googling shows This plugin (disclaimer - I've never used it by myself).
Now in order to make spring boot serving your static content, this question has been already answered in SO Here Basically, you should place the code into some pre-defined directory in build time and you're good to go.

- 39,963
- 4
- 57
- 97
-
Thank you. I was able to get this less maven plugin working. Spring Boot is different and I did not realize what tools were available. Thanks for pointing me in the right direction. – Mule Aug 18 '19 at 15:48