https://github.com/maasdi/react-assets-maven-plugin
This Maven plugin help you sync view template (JSP, FreeMarker, Thymeleaf) and react build assets during build process.
https://github.com/maasdi/react-assets-maven-plugin
java maven maven-plugin react react-assets react-assets-maven-plugin react-scripts reactjs spring spring-boot
Last synced: 5 months ago
JSON representation
This Maven plugin help you sync view template (JSP, FreeMarker, Thymeleaf) and react build assets during build process.
- Host: GitHub
- URL: https://github.com/maasdi/react-assets-maven-plugin
- Owner: maasdi
- Created: 2020-07-17T03:04:32.000Z (almost 6 years ago)
- Default Branch: master
- Last Pushed: 2023-08-15T17:42:35.000Z (almost 3 years ago)
- Last Synced: 2025-05-17T20:35:25.202Z (about 1 year ago)
- Topics: java, maven, maven-plugin, react, react-assets, react-assets-maven-plugin, react-scripts, reactjs, spring, spring-boot
- Language: Java
- Homepage:
- Size: 93.8 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
React Assets Maven Plugin
=======================
[](https://travis-ci.org/maasdi/react-assets-maven-plugin/builds)
[](https://maven-badges.herokuapp.com/maven-central/com.github.maasdi/react-assets-maven-plugin)
This Maven plugin help you sync view template (JSP, FreeMarker, Thymeleaf) and react build assets during build process.
## Objectives
Build React + Spring application with server rendering view sometimes very messy,
because `npm run build` generate files with hash, every time code change the hash will change.
Often we come up with workaround by renaming the files to static file name,
but this can easily break code splitting and lose potential advantages for production [read here](https://create-react-app.dev/docs/production-build/).
This plugin will let you sync those assets and your server rendered view during maven `process-resources` phase.
## Requirements
* Maven 3 and Java 1.8
## Usage
Given that you have template `/src/main/resources/templates/app.ftlh`
```html
Test Server Render HTML
You need to enable JavaScript to run this app.
```
Then
```xml
com.github.maasdi
react-assets-maven-plugin
1.0.1
sync-assets-template
process-resources
${project.basedir}/frontend/build
${project.basedir}/src/main/resources/templates/app.ftlh
${project.basedir}/target/classes/templates
process-asset
```
## Options
* `assetsDirectory` - The react assets directory, this directory should be react build folder or folder with similar structure.
* `resources` - The list of resource to process, possibly JSP, FreeMarker template or Thymeleaf file.
* `manifestName` - The react manifest file name, default value is `asset-manifest.json`.
* `cssMarkup` - The CSS markup that will be replace (case sensitive). default value is ``.
* `jsMarkup` - The Javascript markup that will be replace (case sensitive). default value is ``.
* `runtimeMarkup` - The main-runtime markup that will be replace (case sensitive). default value is ``.
* `publicUrl` - The react asset `PUBLIC_URL`, default value is `/`
* `inlineRuntimeChunk` - By default runtime-asset will be embed, set this parameter to `false` which will load chunk instead of embedding it in your view.
## Sample
There is sample of Spring Boot + React [here](https://github.com/maasdi/react-assets-maven-plugin-sample)
## Licenses:
* Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0