@srubio131/vue-script-loader

1.0.4 • Public • Published



Introduction

Vue Script Loader is a library to inject external scripts dynamicatly on youtr Vue projects

Install

npm install @srubio131/vue-script-loader --save

or

yarn add @srubio131/vue-script-loader

Install

import VueScriptLoader from '@srubio131/vue-script-loader'

Vue.use(VueScriptLoader)
// Or you can specify any other options
Vue.use(VueScriptLoader, {
  name: 'myScriptLoader',
  extraAttrs: {
      id: 10
  },
  parentElement: 'head',
  insertAsLastElement: false, // Add script to the bottom of parentElement; true by default
})

Usage

  • Global instance
Vue.scriptLoader.injectScript('<script></script>')
Vue.scriptLoader.injectScript('<script></script>', {
    parentElement: 'body',
    insertAsLastElement: 'false'
})

License

MIT Licensed | Copyright © 2021-present s.rubio131

Package Sidebar

Install

npm i @srubio131/vue-script-loader

Weekly Downloads

1

Version

1.0.4

License

MIT

Unpacked Size

3.65 kB

Total Files

4

Last publish

Collaborators

  • srubio131