Reputation: 71
I'm using Vue.js framework for my PHP + JS application with using full build of vue. i.e. directly including Vue via a script tag without a build tool.
Now my question is How can I pre-compile my templates without any build tools(Webpack, Browserify).
Thanks in advance
Upvotes: 2
Views: 974
Reputation: 8629
Well, that's a strange question. I guess you are talking about compiling string templates.
It seems obvious that you can't pre-compile your template without any dedicated build tool.
You have at least two solutions to use Vue without build engine, but none of them includes pre-compiling of string templates:
Use the full build of Vue (with compiler included), which can compile your string templates on the fly during execution. It's actually very lightweight and (almost) unnoticeable performance-wise for small to medium app. If you don't want to use any commonJS module and only use it in script tag, you can use the UMD build. It is availible there: https://unpkg.com/vue
You can use render functions directly instead of templates, so you don't need to compile anything. See: https://v2.vuejs.org/v2/guide/render-function.html
Upvotes: 0
Reputation: 28538
(disclamer: author here)
vue3-sfc-loader
, that works for Vue2 & Vue3, allows you to load .vue
files directly from the browser without any build step. Here some examples
Upvotes: 0
Reputation: 152
vue-cli build --prod --lib Hello.vue -w
Upvotes: 1