1.0.4 • Published 5 years ago

edotensei v1.0.4

Weekly downloads
2
License
MIT
Repository
github
Last release
5 years ago

Edotensei.js

PRs Welcome Known Vulnerabilities NPM Version Build Status Contributors Bundlephobia Bundlephobia FOSSA Status

Simple Load HTML (Assets/Resources) on the fly (Browser).

madara

Instalation

$ yarn add edotensei --dev
$ npm install edotensei --save-dev

Usage

  • NPM/Yarn
import Edotensei from 'edotensei'

const scriptList = [
  // Load javascript 
  {
    src: 'main.js', // URL
    async: boolean,
    defer: boolean,
    rel: 'preload|prefetch|dns-prefetch'
  },
  
  // load css
  {
    src: 'main.css', // load css
    rel: 'preload|prefetch|dns-prefetch'
  }
  // add more here {}
];

Edotensei.add(scriptList) // To Add Script Element in Body HTML 

# Make sure to pass same array of scriptList instance/reference
Edotensei.remove(scriptList) // To Remove Script Element in Body HTML
  • HTML
  <script src="https://unpkg.com/edotensei@latest/dist/edotensei.min.js"></script>
  <script>
    const scriptList = [
      { src: "main.js", rel: "preload" },
      { src: "main.css", rel: "preload" },
      { src: "registerServiceWorker.js" },
      { src: "https://fonts.gstatic.com/", rel: "dns-prefetch" },
      { src: "https://fonts.googleapis.com/", rel: "dns-prefetch" }
    ];

    Edotensei.add(scriptList);
  </script>

Example in React

  • add & remove on react lifecycle use-in-react
  • result in browser
    result-in-browser

Contribute & Help

  • Star & Fork Edotensei
  • Post any issues you find (please check existing issues before posting!)
  • Post new feature requests
  • Pull requests are welcome

Contributors

  • Everyone who posted an issue / pull request

License

FOSSA Status

1.0.4

5 years ago

1.0.3-next

5 years ago

1.0.3

5 years ago

1.0.2

6 years ago

1.0.1

6 years ago

1.0.0

6 years ago