Skip to content
This repository has been archived by the owner on Oct 21, 2022. It is now read-only.
/ Edotensei Public archive

πŸŒ’πŸ”₯ Simple Load HTML (Assets/Resources) on the fly (Browser). Zero Dependencies

License

Notifications You must be signed in to change notification settings

r17x/Edotensei

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

76 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

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