Coder Social home page Coder Social logo

chaosengine / svelte-microfrontend-example Goto Github PK

View Code? Open in Web Editor NEW

This project forked from evanfuture/svelte-microfrontend-example

0.0 2.0 0.0 27 KB

Based on a talk: https://slides.com/evanpayne/microfrontends-with-svelte

HTML 4.40% JavaScript 15.73% Svelte 78.84% TypeScript 1.03%

svelte-microfrontend-example's Introduction

Sample Svelte SPA/MicroFrontend

This is a Svelte project that compiles to a single JS file that can be published and ingested by other app-shells in a micro-frontend manner.

Build project

npm run build

Rollup will bundle everything into ./public/build/itemdetail.js That file should then be deployed at a publicly accessbile url.

Using the FE

To use the microfrontend on any other site:

Find the public url of the js file and include it on the page like so: <script type="module" src="https://.../itemdetail.js"></script>

Then, add the html file either immediately after, or dynamically: <itemdetail-spa issueid="1234" theme="dark" baseapiurl="https://evanpayne.com" preview="true" />

baseapiurl can be left off, as can theme. The other props are required.

Attribute order does make a difference. It should be:

  • issueid (required if preview is true)
  • theme (optional, 'light' or 'dark')
  • baseapiurl (optional)
  • preview (required, 'true' or 'false)

svelte-microfrontend-example's People

Contributors

evanfuture avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.