Skip to content

Instantly share code, notes, and snippets.

Avatar

Falk Schieber pixelbucket-dev

View GitHub Profile
@pixelbucket-dev
pixelbucket-dev / stencil-helper.js
Last active Jan 24, 2021 — forked from dogoku/stencil-helper.js
Helper functions that simplify compiling and running stencil source code in the browser – using worker for transpilation
View stencil-helper.js
const myWorker = new Worker('https://gist.githack.com/pixelbucket-dev/b5da356d73f3620f2f18c010c8f7cb00/raw/6647655120b87219f1ab3029eef75d105551edb5/stencil-helper-transpile-worker.js'/* , { type: 'module' } */);
// auto inject the h import, to reduce boilerplate required in source
const h = "import { h } from 'https://cdn.skypack.dev/@stencil/core';\n";
function addHToSources(sources) {
return sources.map(source => h + source);
}
export async function compileStencil(sources) {
if (!sources || !sources.length) {