1.0.4 • Published 3 years ago

@srubio131/vue-script-loader v1.0.4

Weekly downloads
-
License
MIT
Repository
-
Last release
3 years ago

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