Skip to main content
Dublin Library

The Publishing Project

Generic Blog (Web) Components: Introduction and Blog Posts V1

 

A while back I wrote a set of Vue 2 components for a WordPress blog. It wasn't a complete project, was missing functionality that I couldn't figure out how to implement and I was afraid it would lock me into a framework (although I would rather get locked into Vue than any of the other frameworks I've seen out there). Rather than work with a specific framework, I decided to revisit this as custom elements/web components. according to [Custom Elements Everywhere](https://custom-elements-everywhere.com/) most frameworks, at least those that were tested by the site, have pretty good support for custom elements. Even React works with custom elements as long as you make some modifications. There is also an experimental React branch that fully supports custom elements but there's no guarantee that the branch will be merged into the main React codebase. ## So what are web components? Web components are a set of technologies that enable developers to create custom HTML elements that can be used on web pages. The component technologies for web components are: * **Custom elements**: A set of JavaScript APIs that allow you to define custom elements and their behavior, which can then be used as desired in your user interface * **Shadow DOM**: A set of JavaScript APIs for attaching an encapsulated "shadow" DOM tree to an element — rendered separately from the main document DOM — and controlling associated functionality. In this way, you can keep an element's features private, so they can be scripted and styled without the fear of collision with other parts of the document. * **HTML templates**: The