0

I'm relatively new to practical web development, so I apologize if the question is stupid. The crux of the problem: I only want to use Vue on the front end of the site, and on the back I am using a PHP framework (or not a framework, it doesn't matter). Connecting Vue to every page via a CDN seems to be wrong to me. I didn't quite understand how the CLI works, does it generate some kind of static files (like a compiler), or does it definitely need Node? And did I understand correctly that I can't use things like Vuex and vue-router without node.js? Thank you in advance!

1
  • You can use vuex and vue-router without node but the maintability of the code will be harder depending on how much you want to use vue, if is just for some light use you can still use a cdn. The vue-cli uses node to have a dev server so in development mode you don't need to have the PHP rendering the vue, on production vue-cli compiles the code in js/css which then are called in your PHP template Commented Mar 22, 2021 at 3:02

1 Answer 1

1

VueJS and vue-router are totally independent JavaScript framework and router, you do not need NodeJs to use them, you might get confused after using npm but npm is just a package manager, using it is a matter of choice.

The ClI or currently @vue/cli is just a command line that you can use to create new projects and control them, run them etc, using it isn't required when using vue trough a CDN.

About PHP:

There are a lot of ways to use VueJs in PHP but the most convenient one would be creating a PHP API in the back-end and a normal Vue and Axios app in the front-end, this approach is the one you should get used too because its easily implemented in other languages and even PHP frameworks, for example WordPress.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.