express-vue / vue-pronto

Rendering Engine for turning Vue files into Javascript Objects
Apache License 2.0
20 stars 12 forks source link

Implement disableCSR option in vueOptions #88

Closed dseeker closed 5 years ago

dseeker commented 5 years ago

What

Add the ability to disable the CSR javascript output

Why

In some projects, users might want to have separate code bases or use the same SSR with different CSR's on top. I'm currently developing a SSR layer to an existing Vue Weex Mobile application project. Therefore it makes it much easier to be able to have a VUE SSR outputting DOM layouts for SEO/Google/Facebook, but load the compiled Vue/Weex/JS application as an external file instead of baked in with the SSR output.

How

Make BuildScript optional

finishedLayout.end = `${layout.template.end}${layoutObject.disableCSR ? '' : BuildScript(layoutObject.script)}${layout.body.end}${layout.html.end}`;

https://github.com/express-vue/vue-pronto/blob/c88e380fee8656bc3ed21c7d3adb2ef331be07d5/lib/utils/layout.js#L17

Pass vueOption value disableCSR: vueOptions.disableCSR https://github.com/express-vue/vue-pronto/blob/3d716b723b5b4d3c45d04d5eb67f23ee3aaa1bba/lib/renderer/renderer.js#L535 https://github.com/express-vue/vue-pronto/blob/3d716b723b5b4d3c45d04d5eb67f23ee3aaa1bba/lib/renderer/renderer.js#L571

danielcherubini commented 5 years ago

can you please try this again with the new webpack renderer

https://github.com/express-vue/express-vue#migration-to-webpack-renderer

dseeker commented 5 years ago

thanks @danielcherubini, I'm no longer using Vue-Pronto for the project and cannot test this solution