Closed antangible closed 5 years ago
If you don't see the use case, you probably don't need it :)
We use fractal (https://fractal.build/) as pattern lib for our Vue components. Fractal supports different template languages via adapters (Handlebars, Twig, etc.) and with this adapter also Vue templates and Vue single file components.
(In our projects we also use Vue for server and client side rendering.)
Yea, I use Fractal too, but I have no experience with adapters and its integration, if you could write down some lines of code about the usage will be great. :-)
You have to add this adapter via github to your project, e.g. in the package.json
:
"@swey/fractal-vue-adapter": "swey/fractal-vue-adapter#v0.3.5",
In your fractal.js
just set the engine like this:
const Vue = require('vue');
fractal.components.set('engine', '@swey/fractal-vue-adapter');
fractal.components.set('ext', '.(vue|html)');
In the fractal.js
you can also add plugins, e.g.:
Vue.use(require('./src/js/plugins/GlobalsPlugin'));
But I see, I have to add some documentation. Thanks for your feedback!
Nice! It works :-) Thanks friend.
Great!
Please note that you're in a server side rendering context, so the rendering is similar to the rendering in Nuxt. E.g. window
is not available or mounted
will not be called.
We also developed an own hydration system to replace server renderings with client side renderings, but this is not part of this package. So if you run into some problems, just contact me again.
Happy to hear that more people use this adapter :)
Ah understood. I didn't know Nuxt, in fact I'm going to start developing a WebApp (SPA) without reloading the page, but for me both Vue and Vue router (?) are things I do not know enough.
So actually the navigation between pages happens with page reloading? Right?
I would also love to see some documentation on the usage. Maybe you could get some inspiration from this: https://github.com/sumul/fractal-react-adapter :)
Can you provide some note on the usage? It would be appreciate, thanks.