From c9522889a9932672bc4bf2b85b328b1ebeb0ddea Mon Sep 17 00:00:00 2001 From: yasmramos Date: Fri, 29 May 2026 12:10:06 +0000 Subject: [PATCH] feat: add demo-app example project and fix CSS generation --- examples/demo-app/README.md | 114 ++++++++++++++++++ examples/demo-app/pom.xml | 87 +++++++++++++ .../java/com/example/HelloApplication.java | 26 ++++ .../java/com/example/HelloController.java | 14 +++ .../resources/com/example/hello-view.fxml | 27 +++++ .../yasmramos/tailwindfx/TwInstall.java | 17 +-- .../tailwindfx/core/ThemeCssGenerator.java | 12 +- tailwindfx-maven-plugin/pom.xml | 2 +- 8 files changed, 286 insertions(+), 13 deletions(-) create mode 100644 examples/demo-app/README.md create mode 100644 examples/demo-app/pom.xml create mode 100644 examples/demo-app/src/main/java/com/example/HelloApplication.java create mode 100644 examples/demo-app/src/main/java/com/example/HelloController.java create mode 100644 examples/demo-app/src/main/resources/com/example/hello-view.fxml diff --git a/examples/demo-app/README.md b/examples/demo-app/README.md new file mode 100644 index 0000000..114c3a0 --- /dev/null +++ b/examples/demo-app/README.md @@ -0,0 +1,114 @@ +# TailwindFX Example Project + +This is an example project demonstrating how to use TailwindFX with the Maven plugin for build-time CSS generation. + +## Prerequisites + +- Java 17 or higher +- Maven 3.6+ +- TailwindFX installed locally (`mvn install` in the main project) + +## Building the Example + +```bash +cd tailwindfx-example +mvn clean compile +``` + +This will: +1. Scan your Java and FXML files for Tailwind classes +2. Generate an optimized CSS file at `target/classes/css/tailwindfx-generated.css` +3. Compile your application + +## Running the Example + +```bash +mvn javafx:run +``` + +## Project Structure + +``` +tailwindfx-example/ +├── pom.xml # Maven configuration with TailwindFX plugin +├── src/main/java/com/example/ +│ ├── HelloApplication.java # Main application class +│ └── HelloController.java # FXML controller +└── src/main/resources/com/example/ + └── hello-view.fxml # FXML view with Tailwind classes +``` + +## Using Tailwind Classes + +In Java code: +```java +button.getStyleClass().addAll("bg-blue-500", "text-white", "p-4"); +``` + +In FXML: +```xml +