moved global component registry code
This commit is contained in:
parent
cea6054e64
commit
e85a230553
|
@ -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
|
|||
</my-page>
|
||||
```
|
||||
|
||||
> SEE: `/src/index.js` for more information
|
||||
> SEE: `/src/index.js` & `/src/js/registry.js` for more information
|
||||
|
||||
|
||||
### Tests
|
||||
|
|
12
src/index.js
12
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';
|
||||
|
|
|
@ -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);
|
Loading…
Reference in New Issue