This package has been deprecated

Author message:

this package has been deprecated

html-script-loader

0.3.0 • Public • Published

Script Loader Build Status

Asynchronously load Javascript from HTML.

Usage

1. Create an element that requires its own Javascript file


<section class="js-module" data-script-src="/js/cool-module.js">
  <h1>This is a module</h1>
  <p>It does cool things that requires a large Javascript file.</p>
  <p>I care about performance, so I am only going to load said Javascript file as needed.</p>
</section>

2. Load the scriptLoader before the closing body tag of your document

    <script src="/js/lib/scriptLoader.js"></script>
    <script>
      scriptLoader('js-module'); // Pick any class name you'd like.
    </script>
</body>

You can also use the scriptLoader in a module system like Browserify:

var scriptLoader = require('./path/to/scriptLoader.js');
scriptLoader('js-module');

Readme

Keywords

none

Package Sidebar

Install

npm i html-script-loader

Weekly Downloads

1

Version

0.3.0

License

MIT

Last publish

Collaborators

  • restlessbit