@garpunkal/punk-dynamic-modules
v1.0.5
Published
A typescript dynamic modules importer with html attribute
Downloads
6
Maintainers
Readme
@garpunkal/punk-dynamic-modules
A Typescript modules that allows you to dynamically import modules via html attribute
Install
yarn add @garpunkal/punk-dynamic-modules
or
npm install @garpunkal/punk-dynamic-modules
Usage
A the following to your entry typescript file.
Provide the following attributes:
- the HTML attribute used to dynamically call modules
- the path of the typescript module files
- the extension of the module files
import dynamicImports from '@garpunkal/punk-dynamic-modules';
dynamicImports("data-js", "/src/ts/modules/", "ts");
To use the module in HTML, simple add the module name in the HTML element using the dynamic attribute:
<div data-js="Carousel">
...
</div>
Credit
Created by: Joe Diton: https://www.joontide.co.uk
Packaged by: Gareth Wright: https://garpunkal.dev
License
MIT