icestark-loader
icestark-loader is a JavaScript library for loading module. icestark docs.
Installation
npm install @ice/stark-loader --save
API
mount: function
mount(rootElement, entry, rootId: string = 'icestark-loader')
- rootElement: string | function | HTMLElement
- entry: string | string[]
- string with '' is treated as htmlContent
- string without '' is treated as htmlUrl
- string[] is treated as urls for js/css asserts
- rootId: string (defalut 'icestark-loader')
unmount: function
example
<html lang="zh-CN">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<title>ICE BLOCK</title>
</head>
<body>
<div id="moduleWrapper">
</body>
</html>
import { mount, unmount } from '@ice/stark-loader';
// trigger mount
mount('moduleWrapper', 'https://unpkg.com/@icedesign/ability-introduction-block@3.0.1/build/index.html');
// trigger unmount
unmount();
Contributors
Feel free to report any questions as an issue, we'd love to have your helping hand on icestark
.
If you're interested in icestark
, see CONTRIBUTING.md for more information to learn how to get started.