From e85a23055327e378596e5ea6c374d7cfee942163 Mon Sep 17 00:00:00 2001 From: Geoff Doty Date: Sun, 18 Dec 2022 16:28:21 -0500 Subject: [PATCH] moved global component registry code --- README.md | 3 ++- src/index.js | 12 ++---------- src/js/{register.js => registery.js} | 9 ++++++++- 3 files changed, 12 insertions(+), 12 deletions(-) rename src/js/{register.js => registery.js} (67%) diff --git a/README.md b/README.md index 3673ffa..b6e646a 100644 --- a/README.md +++ b/README.md @@ -31,6 +31,7 @@ dist/ <-- `npm run build` app src/ <-- your source code css/ <-- processed css files js/ <-- processed javascript files + registry.js <-- global component registry public/ <-- unprocessed static `/` assets components/ <-- riots components hello-riot/ @@ -68,7 +69,7 @@ This template uses a static object registry to mount global **components** which ``` -> SEE: `/src/index.js` for more information +> SEE: `/src/index.js` & `/src/js/registry.js` for more information ### Tests diff --git a/src/index.js b/src/index.js index 80a4fc1..f3c041a 100644 --- a/src/index.js +++ b/src/index.js @@ -1,10 +1,2 @@ -import {Register} from './js/register.js'; -import HelloRiot from './components/hello-riot/hello-riot.riot'; - -// define global components here -const registry = { - 'hello-riot': HelloRiot -}; - -// register global components -Register(registry); +// bootstraps global components +import './js/registery.js'; diff --git a/src/js/register.js b/src/js/registery.js similarity index 67% rename from src/js/register.js rename to src/js/registery.js index 502a852..c8cc205 100644 --- a/src/js/register.js +++ b/src/js/registery.js @@ -1,4 +1,5 @@ import {register, mount} from 'riot'; +import HelloRiot from '../components/hello-riot/hello-riot.riot'; /** * Register Global Components @@ -20,4 +21,10 @@ export function Register(registry = {}) { }); } -export default Register; +// define global components here +const registry = { + 'hello-riot': HelloRiot +}; + +// export registered global components +export default Register(registry);