In the last couple of articles in the Custom Web Component series I’ve been looking at JET packs – a way of managing supported groups of components as a single logical unit. Once you start to use JET Packs you can then take advantage of a new type of component, a resource. The idea behind resource components is pretty obvious, when you have several components developed, it’s likely that you might start to see repetition in your code which you’d want to refactor into some common class, or perhaps you want to share a common resource bundle or CSS file amongst the components. This is exactly what a resource component is for, so let’s take a look.
What Is a Resource Component?
Fundamentally, a resource component is just a bucket, you can put whatever you like into it using whatever disk layout you like, so can be used for js/ts files, common css, shared images and so forth, as required. The thing is, of course, that it’s a no use on its own. A user would never “install” a resource component directly, it will be installed as a downstream dependency of a standard UI (composite) component. A resource component has no UI itself and would not (for example) appear in the component palette of Visual Builder.
Defining a Resource Component
Resource components are very easy to define – essentially the only required file is a component.json file and that can be very simple, e.g. at a minimum: Read the complete article here.
For regular information become a member in the Developer Partner Community please register here.