plastic-bag
v0.1.0
Published
A library to work with micro frontends.
Downloads
9
Readme
Plastic Bag
Plastic Bag is a Custom Element that uses different strategies to load Frontend applications/components.
Installation
Package
npm install plastic-bag
Registering the Custom Element plastic-bag
:
import 'plastic-bag';
// or
require('plastic-bag');
CDN
<script src="https://unpkg.com/plastic-bag/dist/index.js" />
Examples
<plastic-bag type="script" src="/app.js">
<div id="app-example">Loading...</div>
</plastic-bag>
<plastic-bag type="html-fragment" src="/header.html">
</plastic-bag>
Options
src
URI of the resource that will be loaded.
type
Each type
uses a different strategy to load the application source. Default value: "script"
.
"script"
: fetchs and executesrc
."iframe"
: usesiframe
to displaysrc
."html-fragment"
: fetchssrc
, puts its content insideplastic-bag
and executesscript
tags if present.
Content
The content will be displayed as soon the tag is attatched.
Compatibility
We are working on browser compatibility tests with BrowserStack.