A Brunch skeleton for spring-boot
We created bunch-spring-boot to solve the following problems for one of our Spring-boot projects:
- Minify and concatenate our frontend assets with one command
- Auto deploy frontend changes without re-compiling the app during development
- Apply and build frontend needs such as SASS compiling
- Least impact on maven and Java side of the project
- Must work well with Spring-boot
We looked at other projects such as Webpack and Wro4j. We found that they were either too much of a work around to work with Spring-boot, or too much overhead on the project. Brunch was simple, light weight and met our needs. And it provides a simple interface for a plugin. Hopefully this project will be helpful to others.
-
Install node: http://nodejs.org/
-
Install Brunch globally:
npm install -g brunch
-
Navigate to your Spring Boot resources folder and install brunch-spring-roll
brunch new frontend -s https://github.com/AusDTO/brunch-spring-roll
This creates a frontend folder under resources.
-
cd into your frontend folder and install dependencies
npm install
After you build the spring-boot project mvn spring-boot:run
Build brunch
brunch build
Builds all the assets into the public
directory. Also copies all assets including templates into classes directory so you don't need to run mvn
again.
brunch watch
Same as build
and also listens for any changes to files and runs build as you develop.
brunch build --production
Same as build
and also minifies the assets.