Skip to content

Instantly share code, notes, and snippets.

@jecfish
Created August 31, 2017 15:47
Show Gist options
  • Save jecfish/a46a2462f6f3d92e0858096425fd11f6 to your computer and use it in GitHub Desktop.
Save jecfish/a46a2462f6f3d92e0858096425fd11f6 to your computer and use it in GitHub Desktop.
// index.ts
import * as kebabCase from 'lodash/fp/kebabCase';
import { MyApp } from './app';
import { MyTopBar } from './top-bar';
import { MyTopMessage } from './top-message';
import { MyCards } from './cards';
import { MyPopUpModal } from './pop-up-modal';
// add custom elements here
const elements = {
MyApp,
MyTopBar,
MyTopMessage,
MyCards,
MyPopUpModal,
};
// register all components as kebab case
Object.keys(elements)
.forEach(key => {
customElements.define(kebabCase(key), elements[key])
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment