Skip to content

Commit

Permalink
docs: update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
benny123tw committed Jun 17, 2024
1 parent 8167835 commit c88e9cc
Show file tree
Hide file tree
Showing 2 changed files with 47 additions and 8 deletions.
6 changes: 2 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
# JaVite

This monorepo contains various submodules for integrating Vite with different frameworks and
libraries. The primary focus is on modernizing legacy web applications by leveraging Vite's fast
build capabilities.
This monorepo contains various submodules for integrating Vite with different frameworks and libraries, focusing on modernizing legacy web applications with Vite's fast build capabilities.

## Project Structure

The monorepo is organized into the following submodules:
The monorepo includes the following submodules:

- **vite-spring-webmvc**: Integrates Vite with JSP and Spring MVC applications.

Expand Down
49 changes: 45 additions & 4 deletions vite-spring-webmvc/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,11 @@ views, making it easier to modernize legacy web applications.

## Getting Started

If you need Java 8 support, please use [vite-spring-webmvc-jre8](https://github.com/benny123tw/javite/tree/main/vite-spring-webmvc-jre8).

### Prerequisites

- Java 8 or higher
- Java 17 or higher
- Spring MVC
- Vite

Expand All @@ -23,18 +25,27 @@ views, making it easier to modernize legacy web applications.
Add the following dependency to your Maven `pom.xml` file:

```xml

<dependency>
<groupId>io.github.benny123tw</groupId>
<artifactId>vite-spring-webmvc</artifactId>
<version>1.0.0</version>
<version>0.0.1</version>
</dependency>

<!-- Java 8 support -->
<dependency>
<groupId>io.github.benny123tw</groupId>
<artifactId>vite-spring-webmvc-jre8</artifactId>
<version>0.0.1</version>
</dependency>
```

Or for Gradle:

```groovy
implementation 'io.github.benny123tw:vite-spring-webmvc:1.0.0'
implementation 'io.github.benny123tw:vite-spring-webmvc:0.0.1'
// Java 8 support
implementation 'io.github.benny123tw:vite-spring-webmvc-jre8:0.0.1'
```

### Configuration
Expand Down Expand Up @@ -95,6 +106,34 @@ public class WebConfig implements WebMvcConfigurer {
}
```

#### Enable Vite Configuration

Configure your Spring application to enable Vite:

```java
import io.github.benny123tw.servlet.annotation.EnableVite;

@Configuration
@ComponentScan(basePackages = "com.benny",
includeFilters = @Filter(type = FilterType.ANNOTATION, value = Configuration.class))
@EnableVite
public class AppConfig {

@Bean
public static PropertySourcesPlaceholderConfigurer propertyConfigInDev() {
return new PropertySourcesPlaceholderConfigurer();
}

@Configuration
@Profile("dev")
@PropertySource("classpath:application-dev.properties")
static class DevConfig {

}

}
```

#### Using the `ViteImport` Tag in JSP

Add the taglib declaration to your JSP file and use the `vite:import` tag to include Vite assets:
Expand All @@ -114,6 +153,8 @@ Add the taglib declaration to your JSP file and use the `vite:import` tag to inc
</html>
```

Full example available on [benny123tw/vite-jsp-demo](https://github.com/benny123tw/vite-jsp-demo).

## Contributing

Contributions are welcome! Please feel free to submit a Pull Request.
Expand Down

0 comments on commit c88e9cc

Please sign in to comment.