Hello world: npm-based-with-tailwind-css
1. Double-click to run the start_env.bat file
2. Run the `ttcli init` commands in the terminal window
$ ttcli init
? Group: com.example
? Artifact: demo
? Project Name: Demo
? Select Spring Boot version 3.3.2
? Select live reload implementation: npm-based-with-tailwind-css
? Web dependencies
? Tailwind dependencies
? Generating Spring Boot project
?? Using node v22.5.1 with npm 10.8.2
3. add a line to the file src\main\resources\application.properties
spring.profiles.active=local
4. Run the project
$ cd demo
$ mvnw spring-boot:run
5. watch
Now change the HTML by changing the text, or adding other Tailwind CSS classes and notice how your browser will automatically reload and apply the changes.
6. chang
src\main\resources\templates\index.html to
<!DOCTYPE html>
<html lang="en"
xmlns:th="http://www.thymeleaf.org"
xmlns:layout="http://www.ultraq.net.nz/thymeleaf/layout"
layout:decorate="~{layout/main}">
<body>
<div layout:fragment="content" class="m-4">
<div class="text-xl">Welcome to your Spring Boot with Thymeleaf project!</div>
<div>See <code class="bg-yellow-500 px-2">HELP.md</code> for instructions on how to get started.</div>
</div>
</body>
</html>


评论
发表评论