import-html-entry
    TypeScript icon, indicating that this package has built-in type declarations

    1.11.1 • Public • Published

    import-html-entry

    Treats the index html as manifest and loads the assets(css,js), get the exports from entry script.

    <!-- subApp/index.html -->
    
    <!DOCTYPE html>
    <html lang="en">
    <head>
        <meta charset="UTF-8">
        <title>test</title>
    </head>
    <body>
    
    <!-- mark the entry script with entry attribute -->
    <script src="https://unpkg.com/mobx@5.0.3/lib/mobx.umd.js" entry></script>
    <script src="https://unpkg.com/react@16.4.2/umd/react.production.min.js"></script>
    </body>
    </html>
    import importHTML from 'import-html-entry';
    
    importHTML('./subApp/index.html')
        .then(res => {
            console.log(res.template);
    
            res.execScripts().then(exports => {
                const mobx = exports;
                const { observable } = mobx;
                observable({
                    name: 'kuitos'
                })	
            })
    });

    Keywords

    Install

    npm i import-html-entry

    DownloadsWeekly Downloads

    5,701

    Version

    1.11.1

    License

    MIT

    Unpacked Size

    62.9 kB

    Total Files

    10

    Last publish

    Collaborators

    • kuitos