Monday, May 11, 2020

Vue - vue-custom-element

Vue-custom-element seems like the best way to integrate vue into an existing application that uses server side templates.

This approach allows you to use vue components (built with the build pipeline) in your existing html without making your entire application a SPA.

Initially I started following this guide:

Vue-custom-element turned that code into 3 lines and allowed using components like normal (without the data attributes).

This approach seems much better than: Which doesn't allow for using a build pipeline for babel, linting, testing, single page components, live reload, modules with import/require, etc.

Targeting your builds for web components might do the same thing: It says it's not compatible with IE11, but that might not be a big deal in most situations.

Tuesday, May 5, 2020

Django - Requiring Prefetching

I made a repository to try to figure out the best way to require prefech_related/select_related when fetching a model's related objects. I also want to figure out a good pattern for avoiding duplicated prefetch_related/select_related for multiple places in a codebase that need the related objects eager loaded in the same way.