Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Building SPA frontend without node/npm

I'm a back-end java developer (spring boot) and currently I'm interested in building a single page application.

What I like about SPA frameworks (mostly Vue): Model-binding (saves boilerplate code) Components and templates (separating code in multiple files is always good, but I don't like single file components as I feel they mix the view and logic) Routers

However, unless you are using Node there seems to be poor integration What I don't like: Node (I develop backend in Java so I don't want to install node just as a prerequisite for NPM) NPM (I already have dependency management in Maven/Gradle. I actually don't mind it as much, I just don't want to install it and manage it seperately)

I understand why stuff like Node, Npm, Webpack is necessary, it's just that I've already have Java/Spring/Eclipse doing all that for me. I have no desire to have basically two separate build processes.

TLDR: I like the direction and architecture of modern frontend, I just don't want to deal with the tools that are used.

Specific Question: How can I develop a modern SPA using Spring Boot, Gradle/Maven and Vue.js and not have to install Node/Npm/Vue cli etc. What are the best tools if there are any?

Thank you.

like image 428
hamenaglar Avatar asked Nov 07 '22 06:11

hamenaglar


1 Answers

You can use maven frontend plugin hosted from here.

It is maven plugin that is leveraging downloading nodejs, webpack, gulp, grunt and running it on your codebase.

You will be able to run maven build and nodejs will be downloaded automatically. It will run your frontend build as well and in resulting jar you will have only necessary minified files.

However, you have to be aware that if you want to debug your frontend application it is a good idea to have those things installed and being able to run the app locally without minification of html and js files.

If you don`t want to download tools you can use helper scripts provided by authors of this plugin to use tools downloaded by this plugin.

like image 84
Tomasz Bawor Avatar answered Nov 12 '22 20:11

Tomasz Bawor